Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time


Sample data and scripts using Microsoft spatial SQL. Code developed using SQL Server 2008 R2, but everything still works as of April 2016 up through Microsoft SQL Server 2014. Any suggestions or improvements are welcome. UPDATE, this should all still work as of July 2018, but some of the links in the blog postings are going to technical pages that are no longer supported. I will eventually get the links updated, but no promises!

All scripts and tables used here are based on the GEOMETRY data type

Data used in scripts and tutorials can be downloaded here (it's a 28mb zip). All data originally downloaded from Natural Earth's awesome website

A number of tutorials are available from

Part 1 - Welcome to Spatial SQL

Part 2 - Basic Spatial SQL Scripts

Part 3 - More Basic Spatial SQL Scripts

Part 4 - Mulit-Point to Line Example