Arithmetic overflow : Fit 100 into numeric (15,-2)

  • Hello,

    I'm having trouble to store (24.00 * 100 / 24.00) into a numeric (15,2) column.

    Even with the ROUND I run into trouble.

    Create table #test

    (

    value1 numeric (15,2)

    ,value2 numeric(15,2)

    ,myvalue numeric(15,12)

    )

    insert into #test

    (value1,value2)

    select 24.00,24.00

    update #test

    SET myvalue=value1*100/value2

    select *

    from #test

    Sqlserver 2000:

    24.0024.00100.000000000000

    Sqlserver 2008 sp1 Cumulative hotfix 7:

    Msg 8115, Level 16, State 7, Line 11

    Arithmetic overflow error converting numeric to data type numeric.

    update #test

    SET myvalue=round(value1*100/value2,15,2)

    Arithmetic overflow error converting numeric to data type numeric.

  • I don't get an error running this on 2K8. I don't have a 2K box to test it on anymore.

    └> bt



    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Thanks, I'll try uninstalling Cumulative 7 when I get approval.

  • It was the connection option numeric round_abort (Database Properties > Options > Numeric Round-Abort)

    Would also work with end result numeric (30,18)

    *Probably in combination with Cumulative hotfix 7

  • Jo Pattyn (5/17/2010)


    It was the connection option numeric round_abort (Database Properties > Options > Numeric Round-Abort)

    That was the weirdest error I've seen in quite a while... thanks for posting what you found the problem to be.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply