How to append the column

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
sachidanand
Participant
Posts: 25
Joined: Sun Oct 23, 2005 12:55 pm

How to append the column

Post by sachidanand »

Hi,

I have one ODBC stage Transformer and Sequential file

there is a column (PRODID) in ODBC and i want to keep
a character 'x' appended for every row
how should i add character in starting of that record

it should look like this
ODBC = 12345
Transformer= x+12345
Sequential file = x12345
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

In the derivation of the column PRODID, concatenate 'x' to the value.

Code: Select all


x:InLink.PRODID

Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
sachidanand
Participant
Posts: 25
Joined: Sun Oct 23, 2005 12:55 pm

Post by sachidanand »

I_Server_Whale wrote:In the derivation of the column PRODID, concatenate 'x' to the value.

Code: Select all


x:InLink.PRODID

Whale.
THANKS

W H A L E ..................
sathish2cool
Participant
Posts: 1
Joined: Thu Jan 04, 2007 6:18 pm
Location: London

Post by sathish2cool »

Hi...

if its going to be table,you can very well write an user defined query like this...

select 'x'||PRODID from tablename;

Hope it helps......

cheers,
Sathish
Regards
Sathish
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Welcome Aboard ! :)
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
wnogalski
Charter Member
Charter Member
Posts: 54
Joined: Thu Jan 06, 2005 10:49 am
Location: Warsaw

Post by wnogalski »

IMHO Whale's solution is much more readlable and easy to maintain - if You have a complex query then it's hard to see the concatenation and You end up wondering: "Why the hell do I have these strings here?".
If You do it in Transformer You can give it a name "AppendX" and at a glance You know that something happens there - double-click and You know all the details.
Regards,
Wojciech Nogalski
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Annotations my friends.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
mchivuku
Participant
Posts: 21
Joined: Sat Feb 04, 2006 7:38 am

Post by mchivuku »

Gurus,

This solution of x:col is gonna return a NULL value if the value of col is NULL.

i have 3 cols to be concatenated say x,y,z.
If isNull(x) then ' ' else x : If isNull(y) then ' ' else y : if isNull(z) then ' ' else z

this condition does not return the value of z ,if the y becomes a NULL value.

How do you solve this?

Thanks,
Murali
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You can use NullToZero() or NullToEmpty() available under DS Transform and can concatinate directly.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply