How to remove leading zeros from column in table.


If column datatype is integer then leading zeros will be removed automatically but if the column datatype is varchar then leading zeros will not be removed while selecting data.

Create table #Rpt
(
  num varchar(100)
)

Insert into #Rpt(num)
Select '000000' union select 
'000001' union select 
'000010' union select 
'000100' union select 
'001000' union select 
'010000' union select 
'100000'  

Select query

select * from #Rpt
LeadingZero Example

Leading Zero Example

Select query with removed leading zero

Select Replace(Ltrim(REPLACE(num,'0',' ')),' ','0') from #Rpt
Leading Zero Remove

Leading Zero Remove