Inserting NULL records even after defining constraint

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

deva
Participant
Posts: 104
Joined: Fri Dec 29, 2006 1:54 pm

Post by deva »

ArndW wrote:Please remember that an empty string, "", is not null. ...
Hi,
Look at the data types . If both are same, then

no need to use stage var/constrain for this. give it in derivation as if IsNull(phone_no) Then N Else Y.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

IsNull() won't work here (the 3rd time might be a charm)! Use

Code: Select all

Trim(In.Col)#''
as your constraint.
Last edited by ArndW on Fri Feb 22, 2008 10:22 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes, please try to keep up. :wink:

And note that there's no "if-then-else" in Arnd's constraint, no "then N else Y' or "then @TRUE else @FALSE" as that is completely unnecessary. These are expressions and they will automagically evaluate to true or false if you let them - and you should let them do so if at all possible.
-craig

"You can never have too many knives" -- Logan Nine Fingers
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Re: Inserting NULL records even after defining constraint

Post by satya99 »

Try this

If isnull(trimf(trimb(LK1.PHONE))) or trimf(trimb(LK1.PHONE)) Then @True else @False
satya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please try to keep up.

If expression Then @TRUE Else @FALSE is superfluous.

It is sufficient to use (expression) alone.

If the value of expression is "" or 0 (or anything equal to 0) then the result of expression in a Boolean (logical) context is @FALSE. Any other non-null value is regarded as @TRUE.
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