Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting money to char
Message
 
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00818579
Message ID:
00818639
Views:
20
This message has been marked as the solution to the initial question of the thread.
Hi Roy,

You can use CONVERT function to insert commas and than add '$' in front.
SELECT '$' + CONVERT( varchar(32), $15765.27, 1)
I think the BOL sample is wrong.

>Hi,
>
>I would like to convert a money data type to character WITH the '$' and any commas.
>
>I saw this in "SQL Server Books Online" help.
>
>
>"For example, the following CAST function converts the numeric value of $157.27 into a character string of '$157.27':
>
>CAST ( $157.27 AS VARCHAR(10) ) "
>
>
>Now I tried it, but I don't get a string of '$157.27', I get '157.27'. Is this a typo on the help or I need to set some kind of setting? Is there a way to include the $ and commas other than writing my own character parsing function to put them in there?
>
>Thanks.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform