Monday

sql add zeros in front of number

Right function can be use to perform this formatting.For example - if we have table with
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:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...