How to remove leading zeros from a field in a SQL statement ?

1.6K    Asked by ranjan_6399 in SQL Server , Asked on Mar 23, 2021

I am working on a SQL query that reads from a SQLServer database to produce  extract files. We are required to remove the leading zeros from a particular field, which is a simple VARCHAR(10) field.

 For example, if the field contains '00001B', the SELECT statement needs to return the data as '1B'.

Is there a way in SQL to easily trim leading zero? I know there is an RTRIM function, but this seems only to remove spaces but not sql trim leading zero.

Answered by Ranjana Admin

Your Answer

Interviews

Parent Categories