Skip to content
Menu
geoMusings
  • About
geoMusings

Spatial References in SQL Server 2008, Part 2

Posted on 2007-11-26

With some guidance from Paul Ramsey, I implemented a check constraint on my sample table to allow only a single SRID in a table. As Paul indicated in his comment on my previous post, PostGIS does this for you. SQL 2008 doesn’t yet but I hope it does. The syntax for my table was:

[sourcecode language=”sql”]
–only allow WGS84
ALTER TABLE SpatialTable
ADD CONSTRAINT enforce_srid_geometry CHECK (GeomCol1.STSrid = 4326);
[/sourcecode]

After doing that, the following SQL will properly fail:

[sourcecode language=”sql”]
UPDATE SpatialTable
SET GeomCol1.STSrid = 4127;
[/sourcecode]

Thanks to Paul for chiming in!

Share this:

  • Twitter
  • LinkedIn
  • WhatsApp
  • Telegram
  • Email
  • Print

Pages

  • About

Recent Posts

  • New Directions
  • Stripe API Pagination in FME
  • Mission Accomplished
  • Organizational Muscle Memory
  • Integrating Stripe with BigQuery

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org




Web Analytics Made Easy - StatCounter


©2023 geoMusings | WordPress Theme: EcoCoded