Page 1 of 1

how to strip leading 0's from numeric data

Posted: Thu Jun 02, 2005 11:40 am
by tcat2000
Hi,

does anyone know how to strip leading zeros from numeric fields.

ie. 021121234 - > 21121234

thanks

Posted: Thu Jun 02, 2005 11:44 am
by Sainath.Srinivasan
If you move it to a numeric field, it will automatically do it for you.

Posted: Thu Jun 02, 2005 4:14 pm
by ray.wurlod
You can perform arithmetic on it. For example add zero to it. DataStage returns the shortest possible string when arithmetic results are presented.

Other approaches use the Trim() function, the Fmt() function, or the Iconv() function, not to mention reinventing the wheel by writing your own routine.

But arithmetic, or Sainath's solution (loading into an Integer column will automatically remove the leading zero), are the efficient mechanisms.