• cengland0 (10/28/2009)


    Also, if I'm rounding a number, I'm trying to reduce the number of digits after the decimal. If it keeps the same number of digits, why round it?

    Good example:

    Select 123.45 * 1.07

    This is how much tax @ 7% to charge a customer and then add the original 123.45 back in. The answer is 132.0915. Now if I need to round that number, I would expect the final dollar amount to be 132.09.

    select round(123.45 * 1.07,2)

    This results in 132.0900 -- a little confusing if I'm going to be generating a report showing total sales after tax.

    Anyone have a good solution to get the 132.09 as a result of a simple formula?

    I would use the reporting application to present the desired format. However if you are going to have to output the raw data then you have multiple options. For instance: SELECT CAST(ROUND(123.45 * 1.07,2) AS numeric(9, 2))

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers