Microsoft KB Archive/326810

= FIX: A query that references a view that uses UNION operator may return incorrect results =

Article ID: 326810

Article Last Modified on 9/27/2005

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q326810



Bug #: 361320 (SQL Server 8.0)



SYMPTOMS
When you run a query, the query may return results that are not correct if all the following conditions are true:
 * The query execution plan contains the Distinct Sort logical operator, and the Distinct Sort logical operator is on a Join logical operator.
 * The Join logical operator is on a Rank logical operator.

This problem may occur if the query references a view that uses the Union logical operator to perform a join between two or more tables.



Service pack information
To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000 Analysis Services. 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

Hotfix information
The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.   Date      Time   Version    Size    File name --  29-Jul-02 15:38  8.00.665 7,462,996 Sqlservr.exe Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.



WORKAROUND
To work around the problem, perform one of the following actions:
 * Re-create the underlying view to use the DISTINCT operator and the UNION ALL operator instead of the UNION operator in the view definition query.
 * Force the query execution plan to use a LOOP JOIN hint, a MERGE JOIN hint, or a HASH JOIN hint by using the OPTION clause in the query.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.

This problem was first corrected in SQL Server 2000 Analysis Services Service Pack 3.

Additional query words: Rank DISTINCT SORT

Keywords: kbbug kbfix kbview kbqfe kbdatabase kbsqlserv2000sp3fix kbquery kbhotfixserver KB326810

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.