I have the following table A:
id ---- 1 2 12 123 1234
I need to left-pad the id values with zero\'s:
id
id ---- 0
Try this:
SELECT RIGHT(REPLICATE('0',4)+CAST(Id AS VARCHAR(4)),4) FROM [Table A]