MS SQL 2000 formatting numeric value to money

MS SQL 2000 formatting numeric value to money

am 08.11.2007 21:51:19 von jkozik

How to formatting numeric value like 20,5 to money value like 20,50 USD
using MS SQL server 2000


regards IJKK

Re: MS SQL 2000 formatting numeric value to money

am 08.11.2007 23:02:47 von Erland Sommarskog

Jaros³aw Kozik (jkozik@op.pl) writes:
> How to formatting numeric value like 20,5 to money value like 20,50 USD
> using MS SQL server 2000

replace(ltrim(str(@val, 17, 2)), '.', ',') + ' USD'

But you are really better off doing this client-side where you can format
to the client's regional settings etc.


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx