convert char into integer function?

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
bhargav_dd
Premium Member
Premium Member
Posts: 57
Joined: Tue Jun 30, 2009 9:38 am

convert char into integer function?

Post by bhargav_dd »

How can I convert a varchar data type into a numeric data type then insert it into a varchar field in a datatabase.

For example, I need to clean up the leading zeros of this string "00000000000009700477" then insert it into a field with charvar data type.

Note that I cannot change the charvar data type to integer or numeric data type in the target table.

Example:

Source (flat file) leading zeros in numeric Data ---> Taget table: dont want leading zeros in varchar field.

00000000000009700477 want to see only 9700477

00000000000000000890 want to see only 890

Is there an interger convert function that can be used in transformer to accomplist this task?

Thanks.
Nripendra Chand
Premium Member
Premium Member
Posts: 196
Joined: Tue Nov 23, 2004 11:50 pm
Location: Sydney (Australia)

Post by Nripendra Chand »

Use Asinteger function.
-Nripendra Chand
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Trim the leading zeroes. There's no need to be concerned about converting data type. Use the three-argument version of the Trim() function.
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