Removing decimal places

  • 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)

     

  • DECLARE

    @money MONEY

    SET @money = 63568.2951

    SELECT

    ROUND(@money,2)


    Kindest Regards,

    Amit Lohia

  • 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

  • CONVERT(DECIMAL(19, 2), SUM(op_o.actual_total) )

    _____________
    Code for TallyGenerator

  • 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