ReinForce
ReinForce

Reputation: 101

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.

Upvotes: 1

Views: 3704

Answers (2)

Joe
Joe

Reputation: 11

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.

Upvotes: 1

Alaa
Alaa

Reputation: 575

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

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

Upvotes: 1

Related Questions