This article has been archived. It is offered "as is" and will no longer be updated.
You may receive incorrect results, if your query meets the following conditions:
The query specifies a UNION or a UNION ALL of two or more inputs.
In the UNION, at least one of the SELECT statements return the parameter or variable value (that is, it uses this value in the select list and not in the where clause).
The column returning the variable or parameter value is being used as a join or grouping column higher in the query tree, and this operator is run in parallel, requiring that the data stream be partitioned based on the join or grouping columns.
The following query is an example of one that is subject to this problem:
DECLARE @a SMALLINTSET @a=1SELECT yy, COUNT(*) FROM ( SELECT productid xx, @a yy FROM products UNION ALL SELECT productid xx, unitsinstock yy FROM products ) zzGROUP BY yy
Note This query is not a reproduce scenario for the Northwind database. It is only there to show the form and syntax of a hypothetical query on a hypothetical table named products.
Service pack information
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 How to obtain the latest SQL Server 2000 service pack
The English version of this fix 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.
Note Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.
One of the requirements to result in this incorrect results scenario is that the query picks a parallel plan. To work around this problem, you can disable parallelism either at the query level by using a "MAXDOP 1" hint (see SQL Server Books Online for more information), or at a server level by setting the configuration parameter "Max Degree of Parallelism" to 1 (by using the sp_configure stored procedure).
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 4.