BUG: Arithmetic Overflow Error when Using the Power() Function (231159)



The information in this article applies to:

  • Microsoft SQL Server 6.5 Service Pack 5a

This article was previously published under Q231159
BUG #: 18720 (SQLBUG_65)

SYMPTOMS

When a Power() function operates on an integer value within a multiplication or division statement, if that statement also contains a floating point value, the following error message occurs:
Arithmetic overflow occurred.
For example, the following query statement returns the error message:
select 9520.00 / power(2,4)
				

WORKAROUND

  • Replace the integer value inside of the Power() function with a numeric value. For example:
    select 9520.00 / power(2.0,4)
    						


    -or-
  • Use a local variable to store the result of the power function and then use the local variable in the multiplication or division statement. For example:
    declare @val float
    select @val = power(2,4)
    select 9520.00 / @val
    						

STATUS

Microsoft has confirmed this to be a problem in SQL Server 6.5 Service Pack 5a.


Modification Type:MajorLast Reviewed:10/3/2003
Keywords:kbBug kbpending KB231159