Skip to content

Instantly share code, notes, and snippets.

@dalmat36
Created March 15, 2014 15:40
Show Gist options
  • Save dalmat36/9569173 to your computer and use it in GitHub Desktop.
Save dalmat36/9569173 to your computer and use it in GitHub Desktop.
SQL Server 2012 Format Function
/*FORMAT Function
formats a number as a 10-digit string with leading zeros*/
SELECT FORMAT(1759, 'd10') AS Cust_string;
/*formats a currency to various locale-aware strings*/
SELECT FORMAT(5,'C','en-us') AS US_Value; --US
SELECT FORMAT(5,'C','de-de') AS DE_Value; --Germany
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment