[gdal-dev] Retrieving assigned IDENTITY value from MSSQL
Nyall Dawson
nyall.dawson at gmail.com
Thu Oct 25 16:44:49 PDT 2018
On Fri, 26 Oct 2018 at 02:30, Jerry Faust <jerryfaust1 at gmail.com> wrote:
>
> Hello.
>
>
>
> I created a few tables in SQL Server by importing Shapefiles using ogr2ogr. I am able to edit the features, but have not been able to add new features.
>
>
>
> After stepping through the code, it appears that after successfully inserting the record, the newly assigned FID is not being set into the feature - it is still -1 (OGRNullFID).
>
>
>
> Before I consider making changes, I wonder if I’m just missing something. It would seem that others would have encountered this before.
Coincidentally I fixed a similar issue in QGIS this week -
https://github.com/qgis/QGIS/commit/972250 . If you go ahead with
adapting GDAL my advise here would be to use an OUTPUT clause in your
INSERT instead of using the widespread IDENT_CURRENT approach (for
some reasons outlined in that commit's message).
Nyall
More information about the gdal-dev
mailing list