This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 351305 (SHILOH_bugs)
An UPDATE statement that contains a subquery, which selects from a derived table formed from a UNION ALL, may generate the following error message:
Server: Msg 8624, Level 16, State 21, Line 2 Internal SQL Server error.
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
290211 INF: HOw to Obtain the Latest SQL Server 2000 Service Pack
If possible, rewrite the query by using only the UNION operator, without the ALL keyword.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 1.
To reproduce this error, run this script:
CREATE TABLE MaxCol(PK INT PRIMARY KEY,f1 INT,f2 INT,mx INT)GOUPDATE MaxColSET mx = (SELECT MAX(f) FROM ( SELECT f1 AS f FROM MaxCol AS A WHERE A.PK=MaxCol.PK UNION ALL SELECT f2 FROM MaxCol AS B WHERE B.PK=MaxCol.PK ) AS TU )