Compartir a través de


How to: Create XML Indexes

Use an XML index to create indexes for columns of the data type XML, which cannot be indexed using the Index/Keys dialog box. Each XML column can have more than one XML index, but the first one created (primary) will be the basis of the others. If you delete the primary XML index, the others will also be deleted.

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 XML index

  1. In the Server Explorer, right-click the table for which you want to create an XML index and click Open Table Definition.

    The table opens in Table Designer.

  2. Select the XML column for the index.

  3. From the Table Designer menu, click XML Index.

  4. In the Full-text Index dialog box, click Add.

  5. Select the new index in the Selected XML Index list and set properties for the index in the grid to the right.

See Also

Tasks

How to: Delete XML Indexes

Reference

XML Indexes Dialog Box

Other Resources

Working with Indexes