Microsoft KB Archive/286249

From BetaArchive Wiki
Knowledge Base


Article ID: 286249

Article Last Modified on 10/16/2003



APPLIES TO

  • Microsoft SQL Server 2000 Standard Edition



This article was previously published under Q286249

BUG #: 351305 (SHILOH_bugs)

SYMPTOMS

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.

RESOLUTION

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 the Microsoft Knowledge Base:

290211 INF: HOw to Obtain the Latest SQL Server 2000 Service Pack


WORKAROUND

If possible, rewrite the query by using only the UNION operator, without the ALL keyword.

STATUS

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.

MORE INFORMATION

To reproduce this error, run this script:

CREATE TABLE MaxCol(
PK INT PRIMARY KEY,
f1 INT,
f2 INT,
mx INT
)
GO

UPDATE MaxCol
SET 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
    )
                

Keywords: kbbug kbfix kbsqlserv2000sp1fix KB286249