BUG: UPDATE Using Aggregate and Arithmetic Operator Causes AV

Q152214


The information in this article applies to:

BUG#: 15062 (6.00)

SYMPTOMS

In an UPDATE statement within a stored procedure, if a subquery is used to set the value of a column and includes one or more aggregate functions with arithmetic operations, and the arithmetic operation references a column, then a handled thread level access violation may occur.


WORKAROUND

One workaround is to run the UPDATE statement outside of a stored procedure. Otherwise, break up the query and assign the result of the subselect to a variable, and then use the variable in the UPDATE statement.


STATUS

Microsoft has confirmed this to be a problem in SQL Server 6.0.


MORE INFORMATION

For example, the following sample causes an access violation to occur:


CREATE PROCEDURE testproc
AS
UPDATE   t1
SET   a = (SELECT max (t2.b) * t3.c
from   t2, t3
GROUP BY t3.c)
WHERE t1.d = 1
go
EXEC testproc 

Additional query words: Transact-SQL

Keywords : kbprogramming
Issue type : kbbug
Technology : kbSQLServSearch kbAudDeveloper kbSQLServ600


Last Reviewed: February 16, 2000
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.