Unique key warning generated

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Unique key warning generated

Post 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 ?
jpraveen
Participant
Posts: 71
Joined: Sat Jun 06, 2009 7:10 am
Location: HYD

Post 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 .
Jaypee
tanaya.deshpande@tieto.co
Participant
Posts: 94
Joined: Sun Jul 18, 2010 11:35 pm

Post 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
nitkuar
Participant
Posts: 46
Joined: Mon Jun 23, 2008 3:09 am

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post 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
Kandy
_________________
Try and Try again…You will succeed atlast!!
sivanagu
Participant
Posts: 5
Joined: Sun May 29, 2005 4:46 pm

Post by sivanagu »

req needs duplicate records in target table. if it requires remove index on the table.
Post Reply