Page 1 of 1

Unique key warning generated

Posted: Fri Oct 01, 2010 12:55 am
by tanaya.deshpande@tieto.co
I am new at Datastage ..

I am getting these 30 - 40 warnings about violating a Unique Index on a column..
the warning is [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert duplicate key row in object 'dbo.D_Employee' with unique index 'D_Employee_NK'.

How can I handle this ?

Posted: Fri Oct 01, 2010 1:19 am
by jpraveen
Hi Tanaya

You cannot insert Duplicate records in to the table there may be Primary key/Unique Key on the columns.so use remove duplicate stage .

Posted: Fri Oct 01, 2010 1:36 am
by tanaya.deshpande@tieto.co
The info I gave was incomplete

Before adding 4 columns in the job it ran fine
after adding the columns it is giving warning on a column which I did not modify

[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot insert duplicate key row in object 'dbo.D_Employee' with unique index 'D_Employee_NK'.

why did it ran fine earlier

Posted: Fri Oct 01, 2010 3:03 am
by nitkuar
how are you getting these 4 new columns in your job? Are these columns being added after Join. If yes, then after join your input data might get replicated because of duplicate records coming from secondary source. but it all depends upon your answer of my first question.

Posted: Fri Oct 01, 2010 3:36 am
by ArndW
I suspect that if you remove those 4 offending columns the warnings will persist. Can you check and post what your unique index "D_Employee_NK" consists of?

Posted: Fri Oct 01, 2010 5:46 am
by chulett
Much like Arnd, I suspect that the definition of the unique index changed when the four columns were added. Or it could be a data issue, one where you never had duplicate values before and do now. But I would verify the fields that make up the index first so you know what to look for.

Posted: Fri Oct 01, 2010 8:08 am
by kandyshandy
Or may be when you ran first, the table was empty. When you ran again after adding 4 columns, the table was not truncated and you are trying to load the same data with additional information. I asssume that you altered the table rather than dropping and recreating the table

Posted: Fri Oct 01, 2010 8:36 am
by sivanagu
req needs duplicate records in target table. if it requires remove index on the table.