This user-defined function converts a number to character format and adds leading zeroes to pad the field to a specified length. useful for displaying SSNs or other numeric fields where the leading 0's are significant but the field is stored as numeric.
To use:
select dbo.zPad(, )
make sure your length includes an extra column for the sign. If you format an SSN, length = 10.
2007-10-02 (first published: 2002-06-20)
15,450 reads