Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
mhapanka
Creator
Creator

Ltrim in load statement

Hi guys,

I have a field named "Product" that has  numbers which start with zeroes that I want to get rid of.

For example, some of the entries in this field are:

0000002344

00000213456

00000000023

I want to get rid of the zeroes and keep only the numbers

2344

213456

23

and I want to name this new column as "PRODUCT" and I want to do this under a load statement. not in the SQL that extracts this column. I tried a Ltrim but it didnt work

Can someone help me with the code?

1 Solution

Accepted Solutions
sunny_talwar

Try this

Replace(LTrim(Replace(PRODUCT, '0', ' ')), ' ', '0') as PRODUCT

View solution in original post

6 Replies
sunny_talwar

Try this

Replace(LTrim(Replace(PRODUCT, '0', ' ')), ' ', '0') as PRODUCT

mhapanka
Creator
Creator
Author

The field name is in lowercase that I want to rename in uppercase.

do you mean:  Replace(LTrim(Replace(Product, '0', ' ')), ' ', '0') as PRODUCT ?

sunny_talwar

sure

nsetty
Partner - Creator II
Partner - Creator II

Num(Product) AS PRODUCT

mhapanka
Creator
Creator
Author

i also want to convert thefield " prodduct" to text at the same time, how can i incorporate that in the code you provided?

sunny_talwar

May be this

Text(Replace(LTrim(Replace(Product, '0', ' ')), ' ', '0')) as PRODUCT