How do I create a spatial index in SQL Server Management Studio 2008?

3.6k Views Asked by At

I have a table with 3 columns, PrimaryKey(int), latitude(decimal 9,6) and longitude(decimal 9,6).

I've imported a live view into mapinfo 10.5 using its DBMS connection but can't seem to make the table mappable or "create points' to map the coordinates.

I right click to add a new index in MS management studio but the only index types it brings up are clustered, non clustered and xml, no option for spatial.

2

There are 2 best solutions below

0
On

A spatial index can be created only on a column of type geometry or geography.

http://msdn.microsoft.com/en-us/library/bb964740.aspx

0
On

You need to first create a new column (NEWGEOGRAPHY) with a datatype of geometry or geography. Next, update that column with something like this:

UPDATE tablename SET NEWGEOGRAPHY = geography::STGeomFromText(POINT(LATCol LONGCol), 4326)

Then you should be able to create the Spatial index on this table using that column.