Skip to content

Instantly share code, notes, and snippets.

@FilipDeVos
Created May 12, 2011 14:36
Show Gist options
  • Save FilipDeVos/968620 to your computer and use it in GitHub Desktop.
Save FilipDeVos/968620 to your computer and use it in GitHub Desktop.
Pad a number with TSQL
DECLARE @mynumber INT
, @padding INT
SELECT @mynumber = 123
, @padding = 8
SELECT REPLACE(STR(@mynumber, @padding), ' ', '0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment