Page 1 of 1

Values getting NULLed

Posted: Fri Apr 16, 2010 4:34 am
by arnie_nits
Hi,

In a simple one to one load job where I am loading from sequential file to DB, the records are getting NULL and I am getting error:

SQL Server]Violation of PRIMARY KEY constraint
Cannot insert duplicate key in object

Help please.

Regards,
Arnab.

Re: Values getting NULLed

Posted: Fri Apr 16, 2010 5:15 am
by gssr
arnie_nits wrote: SQL Server]Violation of PRIMARY KEY constraint
Cannot insert duplicate key in object
It was clear in the error that you are violating the Primary KEY constraint,

Prefer to remove the duplicate in the key column and try to run the job

Re: Values getting NULLed

Posted: Fri Apr 16, 2010 5:25 am
by Sainath.Srinivasan
arnie_nits wrote: the records are getting NULL
Can you rephrase what it means ? Does the value turn into NULL and hence the error ?

Posted: Fri Apr 16, 2010 5:36 am
by arnie_nits
yes....values are becoming NULL...so I am getting the error..

Posted: Fri Apr 16, 2010 6:14 am
by Sainath.Srinivasan
Did you check with view data or writing to another sequential file ?

Posted: Fri Apr 16, 2010 7:12 am
by chulett
I don't see how anyone could help from the extremely limited information you've posted. If you're certain your key values are "getting NULLed", have you verified where that is happening? Are they being sent to the DB fine and something happens there? Are they lost 'in job' somewhere and sent to the DB as a null? All we can do is guess, you're the only one that can check. Have you tried running through the debugger, step-wise?

If you still need help with this, post the gory details of your job design, then perhaps we can get some idea where this might be happening.

Posted: Fri Apr 16, 2010 9:26 am
by chowdhury99
This is happening because you are trying to load null value in primary key column field. You have to either remove the those null value rows or change that primary key constraint and made that field nullable.

Thanks

Re: Values getting NULLed

Posted: Mon Apr 19, 2010 6:59 am
by PhilHibbs
arnie_nits wrote:In a simple one to one load job where I am loading from sequential file to DB, the records are getting NULL and I am getting error:
The first thing that comes to mind is that when you read a sequential file, an empty string value is (by default) read in to DataStage as @NULL, so if one of your key values is an empty string (which would be odd...) then you will be writing NULL instead. You can specify an alternate representation of NULL values in a Sequential File, but I've never messed with that.

Posted: Mon Apr 19, 2010 1:58 pm
by ray.wurlod
The second thing that comes to mind is that a failed lookup returns nulls from the reference input.