Partager via


How to: Create Spatial Indexes

You can use spatial indexes on columns of the geometry or geography data type (spatial columns), which you cannot index by using the Index/Keys dialog box. You can create more than one spatial index for each spatial column, but you must create them one at a time. For more information, see Spatial Indexing Overview and Restrictions on Spatial Indexes on the Microsoft Web site.

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.

To create a spatial index

  1. In Server Explorer, click the database table that contains the column for which you want to create the index.

  2. On the Database menu, click Open Table Definition.

    The table opens in Table Designer.

  3. Click a column of the geometry or geography data type.

  4. On the Table Designer menu, click Spatial Index.

  5. In the Spatial Indexes dialog box, click Add.

  6. In the Selected Spatial Index list, click the index that you want to create.

  7. In the properties grid, set the properties for the spatial index. For more information, see Spatial Indexes Dialog Box.

See Also

Tasks

How to: Create Tables

How to: Delete Spatial Indexes

How to: Open Table Designer

Other Resources

Working with Indexes