trim the data leading zero
Moderators: chulett, rschirm, roy
trim the data leading zero
Hi
My source data is like this.
000000001
000008753
000026843
000000084
I need the out put data as
1
8753
26843
84
i want to trim leading 0 . how can i do it.
At present i am applying the trim like this, it is not working.
Lnk1.VEND_NUM = Trim(Lnk1.VEND_NUM, "0", "F")
Please correct me.
Thanks
SReddy
My source data is like this.
000000001
000008753
000026843
000000084
I need the out put data as
1
8753
26843
84
i want to trim leading 0 . how can i do it.
At present i am applying the trim like this, it is not working.
Lnk1.VEND_NUM = Trim(Lnk1.VEND_NUM, "0", "F")
Please correct me.
Thanks
SReddy
Code: Select all
Lnk1.VEND_NUM = Trim(Lnk1.VEND_NUM, "0", "L")
You have to use L option in Trim command
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 57
- Joined: Wed Oct 21, 2009 4:46 am
- Location: India
Have you tried that for yourself? You may just find it is the decimal causing the zeroes... and as Craig has hinted at, the OP needs to consider making his target type a Stringrohithmuthyala wrote:Convert the source data from string to decimal...automatically the zero's will be stripped off. If you still want the source data to be string then convert it back from decimal to string..!
Assumption:Kryt0n wrote:Have you tried that for yourself? You may just find it is the decimal causing the zeroes... and as Craig has hinted at, the OP needs to consider making his target type a Stringrohithmuthyala wrote:Convert the source data from string to decimal...automatically the zero's will be stripped off. If you still want the source data to be string then convert it back from decimal to string..!
The Incoming Field is Decimal and output is Varchar
Try this expression
DecimalToString(inCol,"suppress_zero")
If the Incoming Field is not Decimal ,try converting to Decimal [/img]
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
In these scenarios you need to mention the data type(source/target).
Source: string Target: string Result: trim(col_name,'0','L') will work
Source: decimal Target: string
Result: DecimalToString(col_name,'suppress_zero') will work
Note:- trim(DecimalToString(col_name),'0','L') will not work as Sainath mentioned the problem below.
DSExperts / Sainath can you guys please be more elaborative on the above trim issue will be really great !!!
Source: string Target: string Result: trim(col_name,'0','L') will work
Source: decimal Target: string
Result: DecimalToString(col_name,'suppress_zero') will work
Note:- trim(DecimalToString(col_name),'0','L') will not work as Sainath mentioned the problem below.
DSExperts / Sainath can you guys please be more elaborative on the above trim issue will be really great !!!
IBM Certified - Information Server 8.1
I don't understand why people feel the need to come in and repeatedly speculate on what the answer might be without full disclosure of the issue from the original poster.
I don't know about anyone else but I was planning on waiting for sreddy to come back before continuing this. Didn't quite work out but... fades back into the darkness...
![Wink :wink:](./images/smilies/icon_wink.gif)
I don't know about anyone else but I was planning on waiting for sreddy to come back before continuing this. Didn't quite work out but... fades back into the darkness...
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers