Have to remove 0's from varchar field

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
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Have to remove 0's from varchar field

Post by Amarpreet »

I have a varchar field, which contains values like 00234,00980,.....

I have to remove all the 0's from the left of this value. my result should be 234,980,......
which function should I use in Datastage to achieve this?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Doing an arithmatic manipulation on a charcter forces it to be changed to an integer. Just try multiplying it by 1 that should work.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You can also do a TRIM(In.Column,'0','L') which will remove all leading "0" characters from your column.
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

Assuming the data is as shown in your post, you will have to separate the data based on the ',' delimiter before implementing the solutions suggested by Arnd and Guru. Rebuild the string, putting the ',' back in after the manipulation.

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

rwierdsm wrote:Assuming the data is as shown in your post, you will have to separate the data based on the ',' delimiter before implementing the solutions suggested by Arnd and Guru. Rebuild the string, putting the ',' back in after the manipulation.

Rob
It is assumed, Amarpreet has given the values for single filed in order seperated by comma and not all together a single field value.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Post by Amarpreet »

Thanks, its working
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Post by Amarpreet »

Yes those were 2 separate values(just exmaple values). Used trim function, which is working just perfectly. Thanks a ton.....
Post Reply