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

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.
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.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog