BUG: Regression: Message 515 When Doing UPDATE with ISNULL, an Aggregate, and a Correlated SubqueryID: Q179163
|
With SQL Server 6.5 Service Pack 2 and later, updating a column defined as NOT NULL by using a SELECT statement with ISNULL, an aggregate, and a correlated subquery will generate msg 515 (Attempt to insert the value NULL into column) when there are additional rows in the target table without corresponding rows in the source table.
To work around this problem, do any one of the following;
Microsoft has confirmed this to be a problem in SQL Server version 6.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
The following is an example:
UPDATE
TblX
SET
ColB = (SELECT
ISNULL(SUM(ColC),0)
FROM
TblY
WHERE
TblX.ColA = TblY.ColA
GROUP BY
TblY.ColA)
Additional query words:
subquery crltd crrltd SUM error set null sp sp1 sp2
sp3 sp4 st proc stproc
Keywords : SSrvGen kbbug6.50.sp2 kbbug6.50.sp3 kbbug6.50.sp4
Version : WINNT:6.5
Platform : winnt
Issue type : kbbug
Last Reviewed: April 19, 1999