Check out example codes for "tsql pad left". It will help you in understanding the concepts better.

Code Example 1

declare @T table(id int)
insert into @T values
(1),
(2),
(12),
(123),
(1234)

select right('0000'+convert(varchar(4), id), 4)
from @T

Learn ReactJs, React Native from akashmittal.com