Hi,
I have a decimal field of length (38,0) in my source table. In the target I want to put it as a varchar field.
I am using the TRIM function to remove leading '0's from the source field but '0's are not getting removed. Now I am using DecimalToString function which is working fine.
But I am still curious to know why trim function below is not working.
trim(field,"0","L")
Removing leading '0' while decimal to varchar conversion
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 37
- Joined: Wed Oct 29, 2014 10:48 pm
- Location: Ohio
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Premium Member
- Posts: 37
- Joined: Wed Oct 29, 2014 10:48 pm
- Location: Ohio
I think you are right Ray, because I have a leading space for sign. So that means I first need to remove leading space and then leading '0's or rather stick to DecimalTo String with suppress zero.
Thanks Ray. I during this whole time saw this leading Space in the file and it never struck to me that '0's are not leading now. My bad!!
Thanks Ray. I during this whole time saw this leading Space in the file and it never struck to me that '0's are not leading now. My bad!!
-
- Participant
- Posts: 10
- Joined: Sun Aug 11, 2013 10:46 pm
- Location: Dalian
Re: Removing leading '0' while decimal to varchar conversion
I ever avoided the leading zero issue by use VarChar from reading data from DB.