Home Forums SQL Server 2005 T-SQL (SS2K5) Remove decimal places and force leading zeros RE: Remove decimal places and force leading zeros
stimetb
SSC Enthusiast
Points: 193
More actions
October 17, 2012 at 11:37 am
#1550158
What happens if you have digits to right of decimal?
declare @value3 integer
@value3 = 197.81
SELECT RIGHT('000'+CAST(CAST(@value3 AS INT) AS VARCHAR(7)),7)
gives value 000197
any help on this would be appreciated.