Values getting NULLed

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Values getting NULLed

Post 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.
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Re: Values getting NULLed

Post 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
RAJ
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Re: Values getting NULLed

Post 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 ?
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Post by arnie_nits »

yes....values are becoming NULL...so I am getting the error..
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Did you check with view data or writing to another sequential file ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

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

"You can never have too many knives" -- Logan Nine Fingers
chowdhury99
Participant
Posts: 43
Joined: Thu May 29, 2008 8:41 pm

Post 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
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Re: Values getting NULLed

Post 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.
Phil Hibbs | Capgemini
Technical Consultant
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The second thing that comes to mind is that a failed lookup returns nulls from the reference input.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply