How to convert an ESRI Shape-file into SQL Server 2008?

Kristian Frost picture Kristian Frost · Aug 17, 2010 · Viewed 7.8k times · Source

I have a shapefile that I would like to upload to a spatial SQL Server 2008. I have tried using this tool: SQL Server 2008 Spatial Tools. But without luck.

Does anyone know any other (free) tools for doing this?

Answer

Dave Lowther picture Dave Lowther · Aug 20, 2010

You can use ogr2ogr to convert from shapefile to GML (or many other formats) and then use SQL Server's GeomFromGML to import. You will need to call GeomFromGML for each feature in your shapefile, but that's a relatively easy program to write.