Article ID: 286255
Article Last Modified on 11/2/2007
APPLIES TO
- Microsoft SQL Server 2000 Developer Edition
- Microsoft SQL Server 2000 Enterprise Edition
- Microsoft SQL Server 2000 Personal Edition
- Microsoft SQL Server 2000 Standard Edition
- Microsoft SQL Server 2000 Workgroup Edition
This article was previously published under Q286255
BUG #: 351259 (SHILOH_BUGS)
SYMPTOMS
A query statement may fail with error message 8623 if the following conditions are met:
- The query uses the UNION clause.
- One of the SELECT statements in the UNION query has a WHERE clause that refers to a subquery through an IN clause.
- The SQL Server query optimizer chooses a loop join to resolve the query.
The complete text of the error message is:
RESOLUTION
Service pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
290211 How to obtain the latest service pack for SQL Server 2000
Hotfix information
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next SQL Server service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:
NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
The English version of this fix should have the following file attributes or later:
Date Time Version Size File name Platform ------------------------------------------------------------------- 01/13/2001 12:52a 8.00.240 7446589 Sqlservr.exe Intel
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.
WORKAROUND
To work around this behavior:
- Rewrite the query statement and use a join instead of the IN clause subquery.
-or-
Use the OPTION optimizer hint to force a hash union. The example query in the "More Information" section would change to:
SELECT P.EMP_NO, N.ADJ_SCON FROM BATCH_EMPEE P, EMPLOYEE E, NI_CONDITION N WHERE E.EMP_NO = P.EMP_NO AND N.EMP_NO = E.EMP_NO AND P.JOB_ID = 25 AND N.PAYRUN_NO = 0 UNION SELECT P.EMP_NO, '' FROM BATCH_EMPEE P, EMPLOYEE E WHERE E.EMP_NO = P.EMP_NO AND P.JOB_ID = 25 AND E.EMP_NO NOT IN (SELECT EMP_NO FROM NI_CONDITION WHERE PAYRUN_NO = 0) OPTION (HASH UNION)
STATUS
Microsoft has confirmed this to be a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.
MORE INFORMATION
The following query is an example for a statement that might lead to error message 8623:
SELECT P.EMP_NO, N.ADJ_SCON FROM BATCH_EMPEE P, EMPLOYEE E, NI_CONDITION N WHERE E.EMP_NO = P.EMP_NO AND N.EMP_NO = E.EMP_NO AND P.JOB_ID = 25 AND N.PAYRUN_NO = 0 UNION SELECT P.EMP_NO, '' FROM BATCH_EMPEE P, EMPLOYEE E WHERE E.EMP_NO = P.EMP_NO AND P.JOB_ID = 25 AND E.EMP_NO NOT IN (SELECT EMP_NO FROM NI_CONDITION WHERE PAYRUN_NO = 0)
Additional query words: Error Message 8623
Keywords: kbbug kbfix kbqfe KB286255