Geoffrey Emery
Tech Goodness

Enforcing a Common Spatial Reference ID in SQL Server

April 22, 2009 18:13 by gemery

 

This enables you to not let any other Spatial Reference ID inserted into a spatial column. This is inherently allowed but when you want to do operations on the column they must all be of the same spatial reference.

 

alter table customers 
add constraint [enforce_SRID_GeogaphyColumn]
check (location.STSrid = 4326)

 

 

create TABLE customers
(
  FirstName nvarchar(30),
  LatName nvarchar(30)
)
alter table customers 
add location geography
alter table customers 
add constraint [enforce_SRID_GeogaphyColumn]
check (location.STSrid = 4326)
drop table customers

Related posts

Comments

October 20. 2009 02:45

Pass Saliva Drug Test

I posted your blog to my facebook group


Regards

Hugh

Pass Saliva Drug Test

Comments are closed