[gdal-dev] mssql append fails for non-geometry layers

Martin Landa landa.martin at gmail.com
Thu May 3 10:31:44 PDT 2018


Hi all,

let's assume sample data:

$ ogrinfo sample.gpkg

1: SOBR (Point)
2: VLA (None)

Append for geometry layers seems to work:

1) ogr2ogr -f MSSQLSpatial MSSQL:database=kn sample.gpkg sobr

->

1> select count(*) from sobr
2> go

-----------
       5437

2) ogr2ogr -f MSSQLSpatial -append MSSQL:database=kn sample.gpkg sobr

->

1> select count(*) from sobr
2> go

-----------
      10874

The same procedure fails for non-geometry layers:

1) ogr2ogr -f MSSQLSpatial MSSQL:database=kn sample.gpkg vla

->

1> select count(*) from vla
2> go

-----------
        111

2) ogr2ogr -f MSSQLSpatial -append MSSQL:database=kn sample.gpkg vla
ERROR 1: Error creating layer: [Microsoft][SQL Server Native Client 11.0][SQL Se
rver]There is already an object named 'vla' in the database. When using the over
write option and the layer doesn't contain geometry column, you might require to
 use the MSSQLSPATIAL_LIST_ALL_TABLES config option to get the previous layer de
leted before creating the new one.
ERROR 1: Terminating translation prematurely after failed
translation of layer VLA (use -skipfailures to skip errors)

OK, let's try with MSSQLSPATIAL_LIST_ALL_TABLES

3) ogr2ogr -f MSSQLSpatial -append --config
MSSQLSPATIAL_LIST_ALL_TABLES YES MSSQL:database=kn sample.gpkg vla

Same error:

ERROR 1: Error creating layer: [Microsoft][SQL Server Native Client 11.0][SQL Se
rver]There is already an object named 'vla' in the database. When using the over
write option and the layer doesn't contain geometry column, you might require to
 use the MSSQLSPATIAL_LIST_ALL_TABLES config option to get the previous layer de
leted before creating the new one.
ERROR 1: Terminating translation prematurely after failed
translation of layer VLA (use -skipfailures to skip errors)

Number of records unchanged:

1> select count(*) from vla
2> go

-----------
        111

It seems to me as a bug, or is there anything I miss? Thanks for
pointers, Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


More information about the gdal-dev mailing list