[gdal-dev] mssql append fails for non-geometry layers
Tamas Szekeres
szekerest at gmail.com
Thu May 3 13:47:30 PDT 2018
Hi Martin,
For some reason the table hasn't been found and the driver wanted to create
a new table.
I've tried to reproduce this with a shapefile with no geometry uploaded to
MSSQL, but I couldn't.
Can I have your sample data? Which GDAL version has been used?
You could also check what happens by disabling bulk insert by adding *--config
MSSQLSPATIAL_USE_BCP NO*
Thanks,
Tamas
2018-05-03 19:31 GMT+02:00 Martin Landa <landa.martin at gmail.com>:
> 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
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180503/ef618d46/attachment.html>
More information about the gdal-dev
mailing list