March 10, 2006 at 4:00 pm
I have a table that I am working with and one of the fields has a money datatype with the scale set to 4. In the results set I am trying to just return 2 decimal places and can't seem to get it to work.
Here are some different things I've tried. Any help would be appreciated.
SELECT DATEPART(mm, op_o.actual_date),
COUNT(*) AS [Opp Count],
CONVERT(DECIMAL, SUM(op_o.actual_total),2)
FROM op_opportunity op_o
WHERE DATEPART(yy,op_o.actual_date) = '2005'
AND op_o.type = 'Express'
GROUP BY DATEPART(mm, op_o.actual_date)
SELECT DATEPART(mm, op_o.actual_date),
COUNT(*) AS [Opp Count],
CONVERT(MONEY,CAST(SUM(op_o.actual_total)AS CHAR (10)),1)
FROM op_opportunity op_o
WHERE DATEPART(yy,op_o.actual_date) = '2005'
AND op_o.type = 'Express'
GROUP BY DATEPART(mm, op_o.actual_date)
March 10, 2006 at 4:43 pm
DECLARE
@money MONEY
SET @money = 63568.2951
SELECT
ROUND(@money,2)
Amit Lohia
March 13, 2006 at 3:34 pm
I tried that already. All it does is round the number, which makes sense. It still leaves four digits after the decimal though. In this example it is 63568.3000
March 13, 2006 at 3:47 pm
CONVERT(DECIMAL(19, 2), SUM(op_o.actual_total) )
_____________
Code for TallyGenerator
March 13, 2006 at 4:10 pm
That works, thanks.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply