2

I am trying to import an ESRI shape file into SQL Server 2019 under Windows 11.

I have a problem similar to Attempting to use ogr2ogr to convert shapefile to SQL Server table; getting error "unable to find driver mssqlspatial", but the answers there are not helping.

I installed QGIS 3.32.1 in Windows 11 in order to get ogr2ogr. I added "C:\Program Files\QGIS 3.32.1\bin" and even "C:\Program Files\QGIS 3.32.1\apps\gdal\lib\gdalplugins" to my system path. But I get this error:

PS C:\Users\drood...> ogr2ogr -f MSSQLSpatial "MSSQL:server=XPS-17-I9-2;driver=SQL Server;database=Duflo 2001;Trusted_Connection=True;" "D:\OneDrive\Documents\Work\DevDat\India NSS\District shape file 2009\geo2_in2009.shp" -a_srs "EPSG:4326" -lco UPLOAD_GEOM_FORMAT=wkt
ERROR 1: Unable to find driver `MSSQLSpatial'.

Adding "--config MSSQLSPATIAL_USE_BCP NO" per elrobis's answer doesn't help. bendecko says to download GDAL from Tamas Szekeres's site and "install it" but I don't know what that means in practice, perhaps because bendecko downloaded an .msi and currently I see only .zip files

2
  • What does ogrinfo --formats give you?
    – Ian Turton
    Commented Aug 19, 2023 at 16:42
  • Especially, does the output contain driver MSSQLSpatial? The easiest way to install binaries from gisinternals is actually to download a zip, unzip it into some directory, and run "sdkshell.bat".
    – user30184
    Commented Aug 19, 2023 at 20:08

1 Answer 1

1

If you are using the OSGeo4W installer, install gdal-mss library (SQL Native client support)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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