I have noticed an odd issue with the bulk load functionality in the ogr2ogr SQL Server Spatial driver.
When performing bulk load, my datasets crashes with the progress bar showing a single "0" followed by a silent exit of ogr2ogr.
The event viewer shows an access violation in sqlncli11.dll.
The table is created in the database, but for some reason the load itself fails.
Workaround:
I realised that if i used -select to specify just a few attributes, things seemed to work, BUT when I added the last attribute of the source it crashes.
I also realised that swapping the order of the two last attributes also made the bulk load work. Bug?
SQL Server 2019, SQL Native Client v11.0.7462.6 and ogr2ogr 3.5.3. Tested both x86 and x64 versions.
I have noticed an odd issue with the bulk load functionality in the ogr2ogr SQL Server Spatial driver.
When performing bulk load, my datasets crashes with the progress bar showing a single "0" followed by a silent exit of ogr2ogr. The event viewer shows an access violation in sqlncli11.dll. The table is created in the database, but for some reason the load itself fails.
Workaround: I realised that if i used -select to specify just a few attributes, things seemed to work, BUT when I added the last attribute of the source it crashes. I also realised that swapping the order of the two last attributes also made the bulk load work. Bug?
SQL Server 2019, SQL Native Client v11.0.7462.6 and ogr2ogr 3.5.3. Tested both x86 and x64 versions.
Repro:
Using this dataset: https://geodpags.skogsstyrelsen.se/geodataport/data/sksFjallnaragr.zip
This fails:
ogr2ogr -overwrite -progress -f MSSQLSpatial --config MSSQLSPATIAL_USE_BCP TRUE -lco OVERWRITE=YES -lco SCHEMA=dbo "MSSQL:server=localhost;database=Geodata;Trusted_Connection=yes;driver=SQL Server Native Client 11.0" sksFjallnaragr.shp
But this works (note -select swapping columns)
ogr2ogr -overwrite -progress -f MSSQLSpatial --config MSSQLSPATIAL_USE_BCP TRUE -lco OVERWRITE=YES -lco SCHEMA=dbo "MSSQL:server=localhost;database=Geodata;Trusted_Connection=yes;driver=SQL Server Native Client 11.0" sksFjallnaragr.shp -select beskrivnin,objectid