Solved

SQL.  Format the dollar amount to include a comma.

Posted on 2007-03-23
4
809 Views
Last Modified: 2012-05-05
SQL.  SQL 2000

How do I format a dollar amount to include the commas:

I have this statement:

Select   '$' + CONVERT(varchar(12), CAST(isnull(sum(totvalue),0) as numeric(10,2) ))  from vwtotvalue

Which returns $13892.32 , but I would also like it to have the commas:  $13,892.32
0
Comment
Question by:Epicmanagement
  • 2
4 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
Comment Utility
try
Select   '$' + CONVERT(varchar(12), convert(money,coalesce(sum(totvalue),0.00),0) )

 
0
 

Author Comment

by:Epicmanagement
Comment Utility
NO.  That didn't return any commas.
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 249 total points
Comment Utility
try
Select   '$' + CONVERT(varchar(12), convert(money,coalesce(sum(totvalue),0.00),1) )
0
 
LVL 19

Accepted Solution

by:
folderol earned 251 total points
Comment Utility
Select   '$' + CONVERT(varchar(12), convert(money,coalesce(sum(totvalue),0.00)),1)

right parenthesis in wrong position.
no points to me please.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now