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

Martin Landa landa.martin at gmail.com
Fri May 4 05:50:19 PDT 2018


Hi Tamas,

2018-05-03 22:47 GMT+02:00 Tamas Szekeres <szekerest at gmail.com>:

first of all thanks for quick feedback!

> For some reason the table hasn't been found and the driver wanted to create
> a new table.

Right, seems to be like that.

> 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?

Here it is: http://geo102.fsv.cvut.cz/~landa/tmp/sample.gpkg

Using GDAL master + SQL Server 2014

BTW,

There are bunch of errors related to vla (non-geometry layer) when
importing sobr (geometry), but import itself doesn't fail.

$ ogr2ogr -f MSSQLSpatial -append --config
MSSQLSPATIAL_LIST_ALL_TABLES yes MSSQL:database=kn... sample.gpkg sobr
ERROR 1: No column definitions found for table 'dbo.vla', layer not usable.
ERROR 1: No column definitions found for table 'dbo.geometry_columns', layer not
 usable.
ERROR 1: No column definitions found for table 'dbo.spatial_ref_sys', layer not
usable.

> You could also check what happens by disabling bulk insert by adding
> --config MSSQLSPATIAL_USE_BCP NO

Same behaviour,

$ ogr2ogr -f MSSQLSpatial -append --config
MSSQLSPATIAL_LIST_ALL_TABLES yes --config MSSQLSPATIAL_USE_BCP NO
MSSQL:database=kn;... sample.gpkg vla
ERROR 1: No column definitions found for table 'dbo.vla', layer not usable.
ERROR 1: No column definitions found for table 'dbo.geometry_columns', layer not
 usable.
ERROR 1: No column definitions found for table 'dbo.spatial_ref_sys', layer not
usable.
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)

Martin

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


More information about the gdal-dev mailing list