Udostępnij za pośrednictwem


How to: Manage Indexes in a Database (Devices)

The following steps assume that you have a SQL Server Compact 3.5 database available in Server Explorer. For more information, see How to: Create a Database (Devices).

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To create an index for a SQL Server Compact 3.5 database

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data source in which you want to create a new index.

  3. Expand the table for which you want the new index, and then right-click the Indexes folder.

  4. On the shortcut menu, click Create Index.

  5. In the New Index dialog box, type a name for the index, and then click Add.

  6. In the Select Columns from <Table> dialog box, select the columns to be added to the index key, and then click OK.

  7. Click OK to close the New Index dialog box.

To edit index properties in sort-order only

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection and table that contain the index whose properties you want to modify.

  3. Right-click the index, and then click Index Properties.

  4. You can change the sort order in this dialog box.

    You cannot change other index properties except by replacing the existing index with a new one.

To drop an index from a SQL Server Compact 3.5 database

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection from which you want to drop an index.

  3. Expand the table that has the index, expand Indexes, and then right-click the index to be dropped.

  4. On the shortcut menu, click Drop Index.

  5. In the Delete Objects dialog box, click Remove, and then click OK.

See Also

Concepts

Using SQL Server Compact 3.5 Databases (Devices)

Other Resources

New Index

Index Properties