Nulls and Compare Strings

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
New2DS
Participant
Posts: 33
Joined: Sat Jun 26, 2004 9:58 am

Nulls and Compare Strings

Post by New2DS »

Hi All,

We have 50 columns in our source and we don't want to allow nulls in any of the columns. Which will be the the easiest way to do it. Writing a constrait using Not(Isnull(InputColumn)) on every column will be a big pain I think.

One more simple question for you guys but not for me, how do we compare 2 strings without casesensitive. I mean A##rr and A##RR should show as equal. My requirement do not allow me change one of the columns case that is I cannot use Upcase or DownCase to change the case and compare.

thanks,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Nulls and Compare Strings

Post by chulett »

New2DS wrote:One more simple question for you guys but not for me, how do we compare 2 strings without casesensitive. I mean A##rr and A##RR should show as equal. My requirement do not allow me change one of the columns case that is I cannot use Upcase or DownCase to change the case and compare.
Sure you can! :wink: Simply use UpCase in your test. No need to change the actual values.
-craig

"You can never have too many knives" -- Logan Nine Fingers
New2DS
Participant
Posts: 33
Joined: Sat Jun 26, 2004 9:58 am

Post by New2DS »

Thanks Craig,

Do you think is there any easy way to handle all the Nulls??
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
regarding your first question
you can build a transformation to check it so you'll have fewer characters to write.

Code: Select all

If IsNULL(%arg%) Then <substitute string> Else %arg%
now since char columns and numeric columns tend to have different default values you'll need 2 seperate ones.
I guess having Default constraints in your DB is out of the question (and slows down the load performance)
there are other ways but none exists that does the job for you automatically.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

For your constraint, you may consider taking advantage of some of the other properties of null. If you concatenate all of your columns together, and any one of them is null, then the result is null. Now you are left with a single call to IsNull().

Other tricks like this may work. In any case, implement it in stage variables. It is easier to see later.
Post Reply