I am working on a SQL query that reads from a SQLServer database to produce an extract file. One of the requirements to remove the leading zeroes from a particular field, which is a simple VARCHAR(10) field. So, for example, if the field contains '00001A', the SELECT statement needs to return the data as '1A'.
How to remove leading zeroes from a field in a SQL statement
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Dorababu MekaRank #457 · 5.5K reputationPosted Jul 6, 2011, 1:51 AM EDT
Select Substring(Yourcolumnname,patindex
('%[^0]%',ColumnName), 10)
Suthish NairRank #92 · 22.8K reputationPosted Jul 6, 2011, 1:53 AM EDT
Chaitanya57 reputationPosted Jul 6, 2011, 1:57 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Jul 6, 2011, 2:02 AM EDT