Want to trim the leadin zero in a varchar

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
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Want to trim the leadin zero in a varchar

Post by gssr »

I need the following requirement:
Input Sample
000029.96
00000.00
00156.01
00007.12

Required output:
29.96
0.00
156.01
7.12

The dattypes varchar!!

i used the TRIM function to remove the leading zeroes...
TRIM (Link1,'0',"L")

But it is not working...
Can anyone suggest me a solution..

Thanks in advance
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First off, what makes you think it is not working? What is your target field after the trim, another varchar or a decimal?
-craig

"You can never have too many knives" -- Logan Nine Fingers
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

chulett wrote:First off, what makes you think it is not working? What is your target field after the trim, another varchar or a decimal? ...
I tried it, and the output is not changing. The target Column datatype is also Varchar! :cry:
RAJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And is your actual syntax more like TRIM(Link1.ColumnName,'0',"L") and what stage are you doing this in?
-craig

"You can never have too many knives" -- Logan Nine Fingers
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

Yes ,i am using the same syntax ,And i am doing this in a Transformer Stage!
RAJ
gssr
Participant
Posts: 243
Joined: Fri Jan 09, 2009 12:51 am
Location: India

Post by gssr »

The Problem is solved ....Actually there are some spaces and hence i tried the followingand it is fine now!!

Trim((TrimLeadingTrailing(Link1.Column)),'0',"L")

Thanks for your comments,
RAJ
Post Reply