Frequently Asked Questions
Duplicate key error when destroying object
Posted by Mikko Punta (M-Files) on 20 June 2019 10:43 AM
When trying to destroy object, you may get the following kind of error message:
Error 2601, Level 14, State 1, Procedure -, Line 1, Message: Cannot insert duplicate key row in object 'dbo.OBJECTTnnnIS'
with unique index 'IX_OTnnnIS_EXTIDSTAT_EXTID'. The duplicate key value is (5, X). (ERROR: 50000, SQLSTATE: 42000)
There are two objects with the same external ID (X) in the database and this is causing the issue.
External ID of the object needs to be changed, it needs to be set to unique value. There are two options to do this
1) with API call SetExternalID
2) modify the database, in this case please contact M-Files Support for further instructions.