How do I create a spatial index in SQL Server Management Studio 2008?
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.
A spatial index can be created only on a column of type geometry
or geography
.
http://msdn.microsoft.com/en-us/library/bb964740.aspx
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.
精彩评论