Home Forums SQL Server 2008 T-SQL (SS2K8) Format Cast INT as Text RE: Format Cast INT as Text
Aditya Daruka
Old Hand
Points: 339
More actions
October 9, 2013 at 11:10 pm
#1657374
A bit longer, but more obvious.
DECLARE @INTINT= 1 ;
SELECT REPLICATE('0', 2 - LEN(@INT)) + CAST(@INT AS VARCHAR)
Pass the column name instead of @INT