How to: Create Indexes
You can use an index to speed access to data in a database table. You create an index by selecting one or more columns in a table that you want to be able to search on. You can use the index as soon as you save the table.
Note
A new version of Table Designer appears for databases in the SQL Server 2012 format. This topic describes the old version of Table Designer, which you use with databases in earlier formats of SQL Server.
In the new version, you can change a table definition through a graphical interface or directly in a script pane. If you use the graphical interface, the table’s definition is automatically updated in the script pane. To apply the SQL code in the script pane, choose the Update button. For more information about the new version, see How to: Create Database Objects Using Table Designer.
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 Customizing Development Settings in Visual Studio.
To create an index
In Server Explorer, right-click the table for which you want to create an index and click Open Table Definition.
The table opens in Table Designer.
From the Table Designer menu, click Indexes/Keys.
In the Indexes/Keys dialog box, click Add.
Select the new index in the Selected Primary/Unique Key or Index list and set properties for the index in the grid to the right.
Specify any other settings for the index and click Close.
The index is created in the database when you save the table.
Note
Not all databases work with indexes in the same way. For more information, consult your database documentation.