Home Forums SQL Server 2008 T-SQL (SS2K8) concatenate with leading zeros RE: concatenate with leading zeros
andrewbolding
SSC Rookie
Points: 45
More actions
September 30, 2014 at 3:12 pm
#1749266
Try this
SELECT RIGHT('000000' + CAST(Col1 as VARCHAR), 6) + RIGHT('000' + CAST(Col2 as VARCHAR), 3)
Hope this helps.
Edit:
Just saw this was an older post lol