I'm a newbie on SQL Server. What is the most preferred way to import shapefile geometry into MS SQL Server 2016. Not sure how to make it right.

  • This very much depends on what software you have available. – Vince Dec 14 '16 at 16:04
  • see also alastaira.wordpress.com/2011/06/18/… – Kirk Kuykendall Dec 14 '16 at 17:19
  • what type of geometry - point, line, polygon or all? Do you have access to ArcGIS? – DPSSpatial Jan 3 '17 at 16:37
  • THANK YOU VERY MUCH for your Shape2Sql.exe.config file. It took from me much time while i saw your approach. And it run. This way worked. – Тимур Т. Jun 8 '18 at 9:56

Adding to klewis's answer: I got shape2sql.exe to work by adding a Shape2Sql.exe.config file with the following contents:

<?xml version="1.0" encoding="utf-8"?>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />

You can change the to whichever version of Microsoft.SqlServer.Types is applicable to your version of SQL Server.

  • Not sure when this became a requirement, as this was working without this .config file early last year. Copy and pasting the above worked fine for me – Morvael Apr 10 '18 at 9:59

I use a free tool, shape2sql.exe, by SharpGIS.net. Because the tool is unmaintained you may need to copy and rename a dll, SqlServerSpatial110.dll or SqlServerSpatial120.dll to SqlServerSpatial.dll in C:\windows\system32. Also, clear out field "ID Column Name" for the data to import, I'm on Win10 64 bit.


You can use ogr2ogr library to import shapefile to SQL server, check below example and reference:

  -f "MSSQLSpatial" 
  -a_srs "EPSG:2249"



here is a step-by-step guide to use the tool http://www.c-sharpcorner.com/UploadFile/898089/how-to-add-world-map-in-sql-server-2012/

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.