Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. SQL Server
  3. Question
SQL Server

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

Asked by Ranjana Admin Mar 23, 2021 2.4K views 1 answer
Share

About this question

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.

Your answer

1 Answer

More SQL Server discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest SQL Server Blogs

Guides, tips and career advice on SQL Server from JanBask experts.