Save edits Error (Violation of PRIMARY KEY)

04-12-2019 08:23 AM
Occasional Contributor


I have a simple Feature Class stored in a SDE. It is registered as versionned with option to move edits to base.

I am using the arcGIS API to add new features to it via a FeatureLayer service.

The issue I have is "sometimes" the edits are not saved, and it's coming with an error. When I go into the logs in the Server's manager, I can see the following error:

Error: Underlying DBMS error [[Microsoft][SQL Server Native Client 10.0][SQL Server]Violation of PRIMARY KEY constraint 'R7_pk'. Cannot insert duplicate key in object 'dbo.MyLayer'. The duplicate key value is (...).].

I let the database generate the primary keys, so the objectids definitely don't exist prior to me trying to add a new feature. When it happens, I sometimes have to restart the service to make it work (or this is maybe a coincidence/psychological).

As I say it is not systematic, and I can't find a pattern as to when/why it happens.

Any ideas?

Tags (2)
0 Kudos
1 Reply
Occasional Contributor


Can't figure out what the issue is.

0 Kudos