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
A simple example would be
DECLARE @number INTEGER DECLARE @length INTEGER DECLARE @char NVARCHAR(10) SET @number = 1 SET @length = 5 SET @char = '0' SELECT FORMAT(@number, replicate(@char, @length))