[dba-SQLServer] Formatting Numbers IN SQL

Fred Hooper fahooper at trapo.com
Tue Sep 16 13:08:04 CDT 2008


If you only want two decimal places you can use money, like this:

select convert(varchar, convert(money, 12345) ,1)

returns "12,345.00"

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of David
Emerson
Sent: Tuesday, September 16, 2008 1:20 PM
To: dba-SQLServer at databaseadvisors.com
Subject: [dba-SQLServer] Formatting Numbers IN SQL

Since I didn't get a reply I will try another tact.

There doesn't seem to be an SQL equivalent to the Access 
Format(12345,"#,##0").  What is the simplest way of taking a number 
like 12345.00 and converting it to a varchar "12,345"?


Regards

David Emerson
Dalyn Software Ltd
Wellington, New Zealand  

_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list