There are all kinds of cool things you can do with SQL Server 2008 spatial data. A lot of people know that, but not that many have gotten started. Don't put it off, you can get started today using SQL Server 2008 R2 Express. It's simple to get started. Here's how to take your first baby steps:
- Download and install SQL Server 2008 R2 Express. (Do a search using sql server 2008 r2 express download as your search string.)
- Do a spatial query. You'll need to find a spatial data column. How do you do that? The easiest way is to check the system metadata.
select *
from INFORMATION_SCHEMA.COLUMNS
where DATA_TYPE like 'geo%'
- The query reveals that the Address table in the Person schema has a column named SpatialLocation with a data type of geography.
- Issue a simple query against the table.
select * from Person.Address
- Notice the Spatial results tab. Select the Robinson projection. So what does the map depict? The Person.Address table contains the addresses of employees and customers around the world. Although the viewer shows only the first 5,000 rows of the 19,614 addresses in the database, you can see that the addresses define the continental United States and the east coast of Australia somewhat. Because the mouse pointer is hovering over an address stored in the table, you see the details of the row in the box that's displayed over the map surface.
The series continues with part 2 here.
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using
About John Paul Cook
SQL Server MVP based in Houston, Texas. Contributing author to
SQL Server MVP Deep Dives and
SQL Server MVP Deep Dives Volume 2. John is currently on sabbatical from database consulting and is very busy as a full-time nursing student.