Numeric to String conversion

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Rajesekhar
Participant
Posts: 19
Joined: Fri May 14, 2010 3:54 pm

Numeric to String conversion

Post by Rajesekhar »

How can we convert Numeric to VarChar in DataStage?

Please help!!

Thanks, Raj
Rajesekhar Potteti
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

You can assign numeric fields directly to varchar target field. Its implicit conversion
You are the creator of your destiny - Swami Vivekananda
Rajesekhar
Participant
Posts: 19
Joined: Fri May 14, 2010 3:54 pm

Post by Rajesekhar »

I am having a dataset one of the column names is ID whose values are like 000123, 000124 etc.. This is of DataType numeric.

I have a table to which I need to do a lookup using these values.. table has values like 123, 124 etc.. This is of data type VarChar.

So from the above dataset input I need to takeout leading zeros to do a proper lookup and get going.

How can I do that?

I thought of converting numeric to string and strip the leading zeros using Trim function.

Could you suggest me a better way if we have any?

Thanks, Raj.
Rajesekhar Potteti
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Use StringToDecimal() to convert your Varchar field to Integer and join on integer fields. Leading zeros in integer wont affect your join.
You are the creator of your destiny - Swami Vivekananda
Post Reply