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
 Transact-SQL (2000)
 COMPUTE CLAUSE

Author  Topic 

isanlu
Starting Member

7 Posts

Posted - 2005-01-19 : 13:58:47
Hi there

I have a fairly complex SQL statement that uses the Compute Statement to bring back totals for sales. Is there a way to format the results so that it shows the Dollar Sign and only two decimals

Thanks

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-01-19 : 15:04:09
you could convert to varChar through money with a "style":

declare @n float
set @n = 19875647834.9483654

SElect '$' + convert(varChar(30), convert(money, @n), 0) [no comma]
,'$' + convert(varChar(30), convert(money, @n), 1) [comma]
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-01-19 : 15:51:26
Soon someone will come and say that this is a client thing.
Go to Top of Page
   

- Advertisement -