Hi,
i have
select id, name, address from emp. in that id value is comming from other source like '00123' value.
i want to remove leading zeros in dynamic sql query. how can i procede.
id data type is varchar(8). once if i remove the leading zeros.
at run time my data like 'AB123', how can i find the value like.
thanks
vijay

Praveen SreeramRank #134 · 16.8K reputationPosted Jul 11, 2016, 9:59 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 11, 2016, 8:42 PM EDT
Daril148 reputationPosted Nov 19, 2021, 1:28 AM EST
zeros
1 1
2 100
3 000100
4 100100
5 00.001
6 01.001
So if you have a table with zeros as shown above .
The LTRIM removes the leading spaces . And the RTRIM removes the trailing space
SO If we execute the below query
We will get the output as:
We can also do this by casting the specific column as float.