Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Format Currency

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-22 : 12:37:21
Steve writes "I am having problems trying to have totals returned from my queries in the desired format. Please refer to the following SQL query:

Select Convert(money,Sum(expenses),1) AS [Total Expenses] FROM reimbursementRequestData

If the amount returned from this query was say 27617510.64, I am looking for $27,617,510.64. I am going by this information:

CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

In the following table, the column on the left represents the style value for money or smallmoney conversion to character data.














ValueOutput
0 (default)No commas every three digits to the left of the decimal point,
and two digits to the right of the decimal point; for example,
4235.98.
1Commas every three digits to the left of the decimal point, and
two digits to the right of the decimal point; for example, 3,510.92.
2No commas every three digits to the left of the decimal point,
and four digits to the right of the decimal point; for example, 4235.9819.
"
   

- Advertisement -