One Star

[resolved] Violation of PRIMARY KEY constraint on SQL Server Identity

Hi,
I have an SQL Server table with an Identity Column (named ID). I have enabled the "enable identity insert" on the relative tMSSqlOutput but when I launch the job in order to migrate data from an Access DB, I get the following error:
"Violation of PRIMARY KEY constraint 'TABLE_PK'. Cannot insert duplicate key in object 'dbo.TABLE'. The duplicate key value is (0)."
In other words, Talend adds the first row with ID 0, then it adds another row with the same ID 0.
Why it happens? Thanks

It happens because is responsability of MS SQL Server to populate the Identity Column. Remove the Identity Column from the output schema of tMap solve the problem.
1 REPLY
Moderator

Re: [resolved] Violation of PRIMARY KEY constraint on SQL Server Identity

Hi,
Thanks for posting that you resolved it by yourself. It was quick, we didn't have the time to reply.

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.