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:

here is powershell script on how to get list of files from changesets associated with one tfs task

$dllPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\...