Displaying thousand seperators in SQL numbers

If you want to display a number 999999999.99 as 999,999,999.99 then it’s normally best to do this in the front end application but if you must do it in sql the way to do it is with the money type.

You simply store your data as money or convert it to money on the fly using convert. Then wrap the value in a convert to varchar with a style of 1

e.g.

DECLARE @MoneyValue float = 999999999999.99
select CONVERT (varchar, CONVERT(money,@MoneyValue ) ,1)

About these ads

About davidbridge

I run David Bridge Technology Limited and specialise in Database design and development including administration and web application development using .net
This entry was posted in Developer stuff, SQL Stuff and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s