Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying dollar signs in output

Status
Not open for further replies.

chillay

Programmer
Jun 27, 2002
102
0
0
US
I created the following table using the MONEY datatype but all of my queries will not display a dollar sign in the output.

How do I display a dollar sign for my outputs in the AccountPrice column?

CREATE TABLE Account
(
AccountID CHAR(20) PRIMARY KEY NOT NULL,
AccountName CHAR(30) NOT NULL,
AccountDescription CHAR(50) NOT NULL,
AccountPrice MONEY NOT NULL,
);

Thank you
 
Hello amorous

Is this a function, because SQL Server says 'FormatCurrency' is not a recognized function name.

Thank you
 
Sorry...I thought i was replying in a ASP forum...

Ya its a function...if you are displaying your data using ASP front end...

then we use FormatCurrency function....

-VJ
 
Thanks VJ.

Does anyone know how to display data including dollar signs in SQL Server?

Thank you

 
Kinda stumped on this but I thought I would help anyway.
Not sure about the purpose of the money data type if it doesn't output with a currency symbol. Here's a workaround in case there is no way to display the currency symbol straight up.

select '$' + CONVERT(varchar(20),AccountPrice) from testmoney
 
Money refers to the internal storage (4 decimal places, lots of digits ahead of the decimal) and not the display. Numeric data is never stored with formatting in the data. Even datetime is stored as 8 bytes. For example, the time right now

2004-07-06 13:02:05.937

is stored internally as:

0x0000951C00D6CF55

Which means 38172 days since 1900-01-1 (the first four bytes) and 14,077,781/ 300ths seconds since midnight (the last four bytes).

 
Maybe you can say:

SELECT bla..., '$ ' + AccountPrice as AccountPrice
FROM bla...
WHERE bla...

Regards,

Atomic Wedgie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top