Viewing and Modifying Index Properties

By expanding the Indexes folder of a table, you can view all the indexes of a table, including any unique indexes, as shown in the following illustration. (The illustrations in this topic show SQL Server 2005 Compact Edition (SQL Server Compact Edition) Query Analyzer as it appears on a Pocket PC device.)

Screen shot of Query Analyzer with index view

A. Indexes on the Order Details table.B. Tap to create a new index on the Order Details table.C. Unique index.

By expanding an individual index, you can view the columns on which the index is built. The columns are listed in sort order, if the index is sorted on more than one column. To change the order in which a column appears, select the column and tap either the MOVE DOWN or MOVE UP arrow (see the following illustration).

You can also view whether a particular index column is sorted in ascending or descending order. The index column icon shows a downward pointing arrow if it is sorted in descending order, and an upward pointing arrow if it is sorted in ascending order. To change whether a particular column is sorted in ascending or descending order, select the column and tap the sort button (see the following illustration).

To remove a column from an index completely, select the column and tap the delete icon (see the following illustration).

Screen shot of Query Analyzer with index keys view

A. Columns on which the PK_Order_Details index is built.

B. Tap to change the sort order of the OrderID column to ascending.

C. Tap to move the OrderID column down in the sort order of the PK_Order_Details index.

D. Tap to move the ProductID column up in the sort order of the PK_Order_Details index. (ProductID must be selected first.)

E. Tap to drop the OrderID column from the PK_Order_Details index.