FIX: A query that references a view that uses UNION operator may return incorrect results (326810)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q326810
Bug #: 361320 (SQL Server 8.0)
SQL Server 8.0:361320

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.

RESOLUTION

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(Join Type Hint) clause in the query.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.
This problem was first corrected in SQL Server 2000 Analysis Services Service Pack 3.

Modification Type:MinorLast Reviewed:9/27/2005
Keywords:kbHotfixServer kbQFE kbSQLServ2000sp3fix kbDatabase kbView kbQuery kbbug kbfix KB326810 kbAudDeveloper