5/30/2018

Exclude 0 from value in SQL Server


Exclude 0 from value in SQL Server

 

Create Table #TempData

(

ColumnData Varchar(20)

)

 

Insert into #TempData values('063506038')

Insert into #TempData values('0063506038')

Insert into #TempData values('00063506038')

Insert into #TempData values('00000063506038')

 

 

Select * from #TempData

 

Select REPLACE(LTRIM(REPLACE( ColumnData,'0',' ')),' ','0')  From #TempData