Windows 10; GDAL 3.3.1; QGIS 3.2; SS2019;
When attempting to load any shapefile into SQL Server 2019 I'm getting column headers but no rows are importing. I've tried:
Different versions of QGIS (QGIS versions 3.4.11 and 3.2 with the respective OSGeo4W downloads, as mentioned in another thread);
Various tutorials on the net with the respective shapefiles used; and
Read every article I can find relating to uploading shapefiles to SQL Server.
The command I'm using is:
ogr2ogr -f "MSSQLSpatial" "MSSQL:server=MYSERVER;database=DBNAME;trusted_connection=yes;" "SHAPEFILE LOCATION" -lco GEOMETRY_NAME=GEOM -lco GEOM_TYPE=GEOMETRY -nln "NAME OF TABLE" -a_srs "EPSG:4326"
Of course, when following the tutorials I'm using the command exactly as they have it structured and again, using the files they're using but I'm only getting column headers with no rows in MSSMS. I've tried specifying drivers as mentioned here (GDAL ogr2ogr into SQL Server Bulk Insert (BCP) not working). I've checked the CRS in every case to make sure it matches the command before attempting to upload.
On a similar post (Import shapefile to SQL Server 2019 using OGR2OGR), a user said:
I then updated to qGIS 3.20.1 with GDAL 3.3.1, released 2021/06/28 and now I get no rows.
I'm on day three of trying to figure this one out with multiple installs, mods, tweaks, tutorials, etc. What is wrong here?
-nlt PROMOTE_TO_MUTLI
to the command fixed it for me. Let me know if it worked for you