Opened 10 years ago

Closed 5 years ago

#5690 closed defect (wontfix)

SQL Server overwrite option ignored

Reported by: leighghunt Owned by: tamas
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: 1.11.0
Severity: normal Keywords: ogr2ogr sqlserver overwrite
Cc: tamas

Description

When I import from a shapefile into SQL Server, the overwrite option appears to be ignored.

C:\Users\Administrator\Documents>ogr2ogr -overwrite -f "MSSQLSpatial" "MSSQL:server=.;database=geo;trusted_connection=yes" "buildings-subset-small.shp"

I've tried the lco argument too, but the results are the same:

C:\Users\Administrator\Documents>ogr2ogr -f "MSSQLSpatial" "MSSQL:server=.;database=geo;trusted_connection=yes" "buildings-subset-small.shp" -lco "OVERWRITE=TRUE"
select * from buildings_subset_small

ogr_fid     ogr_geometry                                                                                                                                                                                                                                                     objectid                                elevation                               feat_code       source
----------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- --------------------------------------- --------------- ------------------------------
1           0xE6100000010594000000E449C5B41DD96540E2497E5D0CA344C0F2F0B8451DD96540A12BD8420AA344C0D32184E51CD9654096AA970D08A344C0C9A4EF941CD96540B157FAC205A344C0318BC3541CD9654030F3BA6603A344C0901F05251CD965407E51A0FC00A344C045183B061CD96540253F6988FEA244C0E852D2CB1B 75026                                   26.800000000000001                      Building        photo 2006, 0.30m
2           0xE6100000010505000000C882651821D965408CDE7BC75BA344C03654720220D96540404DCD224BA344C085F4007A21D96540C38DBC5B45A344C01B7362D222D96540BED91ED15AA344C0C882651821D965408CDE7BC75BA344C000000000000000000000000000000000000000000000000000000000000000000000000000 64505                                   12.800000000000001                      Building        photo 2002
3           0xE610000001051F00000053D1A4FC1BD96540AE00E88711A344C00E3D07841DD96540737F22C90CA344C057ED69E11DD96540062C57240FA344C0B718089D1ED965406AD03BEE11A344C00A3D3C2020D965409A04EB8215A344C04EECD41221D96540E7B8A42017A344C04D040EA722D96540E5BD55A718A344C0BAE9BCE724 73569                                   11.330000000000000                      Building        photo 2006, 0.30m

(3 row(s) affected)

Upon executing the same ogr2ogr command, there are duplicate rows in the table:

ogr_fid     ogr_geometry                                                                                                                                                                                                                                                     objectid                                elevation                               feat_code       source
----------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- --------------------------------------- --------------- ------------------------------
1           0xE6100000010594000000E449C5B41DD96540E2497E5D0CA344C0F2F0B8451DD96540A12BD8420AA344C0D32184E51CD9654096AA970D08A344C0C9A4EF941CD96540B157FAC205A344C0318BC3541CD9654030F3BA6603A344C0901F05251CD965407E51A0FC00A344C045183B061CD96540253F6988FEA244C0E852D2CB1B 75026                                   26.800000000000001                      Building        photo 2006, 0.30m
2           0xE6100000010505000000C882651821D965408CDE7BC75BA344C03654720220D96540404DCD224BA344C085F4007A21D96540C38DBC5B45A344C01B7362D222D96540BED91ED15AA344C0C882651821D965408CDE7BC75BA344C000000000000000000000000000000000000000000000000000000000000000000000000000 64505                                   12.800000000000001                      Building        photo 2002
3           0xE610000001051F00000053D1A4FC1BD96540AE00E88711A344C00E3D07841DD96540737F22C90CA344C057ED69E11DD96540062C57240FA344C0B718089D1ED965406AD03BEE11A344C00A3D3C2020D965409A04EB8215A344C04EECD41221D96540E7B8A42017A344C04D040EA722D96540E5BD55A718A344C0BAE9BCE724 73569                                   11.330000000000000                      Building        photo 2006, 0.30m
4           0xE6100000010594000000E449C5B41DD96540E2497E5D0CA344C0F2F0B8451DD96540A12BD8420AA344C0D32184E51CD9654096AA970D08A344C0C9A4EF941CD96540B157FAC205A344C0318BC3541CD9654030F3BA6603A344C0901F05251CD965407E51A0FC00A344C045183B061CD96540253F6988FEA244C0E852D2CB1B 75026                                   26.800000000000001                      Building        photo 2006, 0.30m
5           0xE6100000010505000000C882651821D965408CDE7BC75BA344C03654720220D96540404DCD224BA344C085F4007A21D96540C38DBC5B45A344C01B7362D222D96540BED91ED15AA344C0C882651821D965408CDE7BC75BA344C000000000000000000000000000000000000000000000000000000000000000000000000000 64505                                   12.800000000000001                      Building        photo 2002
6           0xE610000001051F00000053D1A4FC1BD96540AE00E88711A344C00E3D07841DD96540737F22C90CA344C057ED69E11DD96540062C57240FA344C0B718089D1ED965406AD03BEE11A344C00A3D3C2020D965409A04EB8215A344C04EECD41221D96540E7B8A42017A344C04D040EA722D96540E5BD55A718A344C0BAE9BCE724 73569                                   11.330000000000000                      Building        photo 2006, 0.30m

(6 row(s) affected)

SQL version:

select @@version

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQL Server 2014 - 12.0.2000.8 (X64) 
	Feb 20 2014 20:04:26 
	Copyright (c) Microsoft Corporation
	Express Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)


(1 row(s) affected)

Attachments (1)

buildings-subset-small.zip (3.4 KB ) - added by leighghunt 10 years ago.

Download all attachments as: .zip

Change History (4)

by leighghunt, 10 years ago

Attachment: buildings-subset-small.zip added

comment:1 by Even Rouault, 10 years ago

Cc: tamas added

comment:2 by tamas, 9 years ago

Owner: changed from warmerdam to tamas

comment:3 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.