column containing numbers and we have to add leading zeros to these number we can do following:
SELECT * FROM Numbers;
Num
12
112
12
122
122
5 row(s) affected.
Formatting:
SELECT RIGHT('00000'+ CONVERT(VARCHAR,Num),6) AS NUM FROM Numbers;
NUM
000012
000112
000012
000122
000122
5 row(s) affected.
No comments:
Post a Comment