Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting money to char
Message
 
 
À
09/08/2003 12:10:30
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00818579
Message ID:
00818639
Vues:
21
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform