• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 853
  • Last Modified:

SQL. Format the dollar amount to include a comma.

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
Epicmanagement
Asked:
Epicmanagement
  • 2
2 Solutions
 
LowfatspreadCommented:
try
Select   '$' + CONVERT(varchar(12), convert(money,coalesce(sum(totvalue),0.00),0) )

 
0
 
EpicmanagementAuthor Commented:
NO.  That didn't return any commas.
0
 
LowfatspreadCommented:
try
Select   '$' + CONVERT(varchar(12), convert(money,coalesce(sum(totvalue),0.00),1) )
0
 
folderolCommented:
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now