Export (0) Print
Expand All

How to: Create a Spatial Index (SQL Server Management Studio)

A spatial index can be created only on a spatial column—that is, a column of type geometry or geography. There are also a number of other restrictions on creating a spatial index. For more information, see Restrictions on Spatial Indexes.

NoteNote

You can create only one spatial index at a time.

To create a spatial index

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.

  2. Expand Databases, expand the database that contains the table with the specified index, and then expand Tables.

  3. Expand the table for which you want to create the index.

  4. Right click Indexes and select New Index.

  5. In the Index name field, enter a name for the index.

  6. In the Index type dropdown list, select Spatial.

  7. To specify the spatial column that you want to index, click Add.

  8. In the Select Columns from <table name> dialog box, select a column of type geometry or geography by clicking the corresponding check box. Any other spatial columns then become uneditable. If you want to select a different spatial column, you must first unclick the currently selected column. When you are done, click OK.

  9. Verify your column selection in the Index key columns grid.

  10. In the Select a page pane of the Index Properties dialog box, click on Spatial.

  11. On the Spatial page, specify the values that you want to use for the spatial properties of the index.

    When creating an index on a geometry type column, you must specify the (X-min,Y-min) and (X-max,Y-max) coordinates of the bounding box. For an index on a geography type column, the bounding-box fields become read-only after you specify the Geography grid tessellation scheme, because geography grid tessellation does not use a bounding box.

    Optionally, you can specify nondefault values for the Cells Per Object field and for the grid density at any level of the tessellation scheme. The default number of cells per object is 16, and the default grid density is Medium.

    For more information about these properties, see Index Properties (Spatial Page).

  12. Click OK.

NoteNote

To create another spatial index on the same or a different spatial column, repeat the preceding steps.

Community Additions

ADD
Show:
© 2014 Microsoft