Hello Team,
Am continuously facing the Error in Error Log like "Error writing to database: Violation of PRIMARY KEY constraint 'PK_oslog_Integration_2_Id'. Cannot insert duplicate key in object 'dbo.oslog_Integration_2'. The duplicate key value is(00b4c367-8546-4738-ab34-9c9948ad50ba).The statement has been terminated." any one help me out here to resolve this Error ?
Thanks and Regards.
Ramesh Pugazhenthi.
Hi Ramesh,
You are trying to insert same identity with two times or have you creare unique index.
thats why you are noyt able to insert data.
check with entity keep primary key as Autonumber
Or check with your unique indexs.
Also check with your code if you are assign varibale in Primary key attributes.
Hope this will help you.
Regards
Rahul
Hi Rahul Sahu,
Our primary key id is in auto number - yes, will it happen with any foreign key attribute like (CountryID , SectorID) you mentioned in your screenshot. If Yes can u share the solution.
The primary key in that error appears to be in an outsystems log entity. PK_oslog_Integration_2_Id will be a primary key on the oslog_Integration_2 entity for the ID field, all tables starting with "oslog" should be Outsystems built in log entities so unless you are trying to directly insert things into log files I think this may be something you may need to connect with support about.
On the other hand if the error refered to entities beginning with "osusr_" in the error then it would be on your own tables that you could do something with.
As per the error it looks like you are trying to insert duplicate values into the primary column of that entity. Could you please let me know what action exactly you are trying to do? Or please share the screen shot of the entity for which you are getting error. Also, check if there was any index created on that entity.
Thanks & Regards,
Sachin
Please check in your logic if you are adding the Id manually and then saving it into DB. As the id is auto increment and if you are not updating manually it won't give any error.
If case of foreign fetch it from DB and then save the foreign key into other table. For foreign key this should not be the case.
Thanks,
Swapnil
Hi Ramesh,Could you please share oml if possible.