Created
October 26, 2016 16:39
-
-
Save tgh0831/976319a745f4bca31aa0a1b0d74c1d74 to your computer and use it in GitHub Desktop.
Short T-SQL example of formatting a number with leading zeroes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--When you have a number that needs to be formatted with leading zeroes | |
DECLARE @idnumber INT= 80253; | |
SELECT @idnumber AS idnumberint, | |
RIGHT('000000'+CAST(@idnumber AS VARCHAR), 6) AS idnumbervarchar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment