I want to export spatial data from SQL Server to ESRI shapefile and I have an issue :
ogr2ogr -f "ESRI Shapefile" " C:\Users\sqlexport.shp "
"MSSQL:server=PORT_7FMW8H2;database=testdbspatial;trusted_connection=yes;
"-sql "select * from DRShape" -overwrite
ERROR 1: Failed to create directory C:\Users\sqlexport.shp for
shapefile datastore.ERROR 1: ESRI Shapefile driver failed to create C:\Users\sqlexport.shp
Best Answer
If that is the exact command copied from your terminal, you simply need to be more careful with the spelling; there are spaces between quotation marks and the output file string. Try and replace your command with this one:
If you have multiple geometry types in the table then you need to see Selecting feature types when using ogr2ogr to convert to shapefile?