none
SQL error - Arithmetic overflow error converting expression to data type int.

    Question

  • Hello,

    I am trying to get result from simple equations as below:

    Select 508828125*5

    Select 98000 * 805545

    But surprisingly not been able to get the result. Error showing is: 

    Arithmetic overflow error converting expression to data type int.

    I tried with bigger values also... but getting the proper result.

    Please do help me out.

    Tuesday, July 17, 2012 7:36 AM

Answers

  • Hello,

    You multiplicate 2 integer values, therefore the result will be an integer as well, but the result exceed the size of an intereger = 2.1 billion.

    Convert a value to bigint and it will work:

    Select CONVERT(bigint, 508828125) * 5


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing

    • Proposed as answer by Chintak Chhapia Tuesday, July 17, 2012 7:54 AM
    • Marked as answer by Kiran Mali Tuesday, July 17, 2012 11:18 AM
    Tuesday, July 17, 2012 7:53 AM