Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Jesse McLain,
This function will add commas to a given number passed as a string, separating thousands, millions, etc. Rather than doing long division to figure out how many "digit groups" there are, it simply reverses the number string, adds the commas after every third digit (after the decimal place, if present), and then re-reverses the string for return.
PRINT dbo.fn_AddCommasToNumberString('20123.12') -- 20,123.12
PRINT dbo.fn_AddCommasToNumberString('2012312') -- 2,012,312
PRINT dbo.fn_AddCommasToNumberString('23') -- 23
Written by Jesse McLain
Ever try to print out a long VARCHAR(MAX)/NVARCHAR(MAX) string, only to find that it's truncated at ...
Quite often, I output information through PRINT command. It works well only when message is shorter ...
print every ascii value from a string
A bit of a break from the SQL Server side with this great new .NET class developed by new author Jer...
label printing, zebra s4m 200pdi, pdf, direct print
As a member of SQLServerCentral, you get free access to loads of fresh content: thousands
of articles and SQL scripts, a library of free eBooks, a weekly database news roundup,
a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals
that makes it such a success.