How to remove the leading Zeros

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
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

How to remove the leading Zeros

Post by arnie_nits »

Hi

I have got a varchar field. The records coming are like 0000006.50 and I want to get only 6.50. How is this possible?

Regards
Arnie
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

TRIM In.String '0' 'F' in a modify stage would do the trick
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Post by arnie_nits »

Is it possible it transformer stage??

regards
Arnie
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Yes, the syntax is different; like the Server stage syntax. It is available in the PDFs or online help.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Since, it is a Varchar field, the same TRIM function will do the trick in Transformer stage aswell.

Code: Select all

Trim(Input_Col,'0','L')
Thanks and Regards!!
dspxlearn
Prabhakar
Participant
Posts: 10
Joined: Mon Apr 02, 2007 6:28 pm
Location: Melbourne

Post by Prabhakar »

Trim(Input_Col,'0','L')

You can not convert 00015.50 to 15.50 when you doing decimal to decimal. The Trim function only work when you convert a column from decimal to Varchar then you can achieve the desired format you needed.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Prabhakar - but he stated in his original post that he had a VarChar() column. :wink:
Post Reply