Microsoft KB Archive/817186

= FIX: A query that performs join operations between multiple tables may return incorrect results =

Article ID: 817186

Article Last Modified on 11/2/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Developer Edition
 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 2000 Enterprise Edition
 * Microsoft SQL Server 2000 Personal Edition
 * Microsoft SQL Server 2000 Enterprise Edition
 * Microsoft SQL Server 2000 Workgroup Edition
 * Microsoft SQL Server 2000 Desktop Engine (Windows)
 * Microsoft SQL Server 2000 Developer Edition
 * Microsoft SQL Server 2000 Enterprise Edition 64-bit

-



BUG #: 364392

(SQL Server 8.0)



SYMPTOMS
When you run a query that performs join operations between multiple tables, the query may return incorrect results. You may see this behavior when the SQL Server query optimizer recognizes the query as a candidate for an internal join strategy known as a star join, and it chooses the star join strategy to perform the join on the tables in the query.



WORKAROUND
To work around this problem, create a temporary table to store the intermediary results or to store the complex aggregations that are based on several joins on the large table. Then, join the other tables with the temporary table. This may prevent the SQL Server query optimizer from using the star join strategy for joining the tables in the query. This, in turn, may cause the query to return the correct results.



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

Hotfix information
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.   Date         Time   Version         Size       File name --  29-Jan-2003  11:48  7.0.9466.0        344,064  Msvcr70.dll 29-Jan-2003 11:48  2000.80.722.0      57,904  Osql.exe 29-Jan-2003 11:48  2000.80.534.0     127,548  Sqdedev.dll 29-Jan-2003 11:48  2000.80.194.0     180,290  Sqlunirl.dll 25-Feb-2003 14:11  2000.80.777.0      29,244  Dbmslpcn.dll 07-Feb-2003 16:14                    786,432  Distmdl.ldf 07-Feb-2003 16:14                  2,359,296  Distmdl.mdf 29-Jan-2003 12:25                        180  Drop_repl_hotfix.sql 31-Jan-2003 11:02  2000.80.763.0   1,557,052  Dtsui.dll 29-Jan-2003 15:48                    746,470  Instdist.sql 29-Jan-2003 12:25                      1,402  Inst_repl_hotfix.sql 07-Feb-2003 17:10  2000.80.765.0      90,692  Msgprox.dll 07-Feb-2003 14:23                  1,065,895  Replmerg.sql 07-Feb-2003 17:10  2000.80.765.0     221,768  Replprov.dll 07-Feb-2003 17:10  2000.80.765.0     307,784  Replrec.dll 06-Mar-2003 15:32                  1,084,369  Replsys.sql 03-Mar-2003 03:48                    104,958  Sp3_serv_uni.sql 19-Mar-2003 04:50  2000.80.789.0      28,672  Sqlevn70.rll 27-Feb-2003 12:04  2000.80.778.0     176,696  Sqlmap70.dll 07-Feb-2003 17:10  2000.80.765.0      57,920  Sqlrepss.dll 19-Mar-2003 04:54  2000.80.789.0   7,540,820  Sqlservr.exe 07-Feb-2003 17:10  2000.80.765.0      45,644  Sqlvdi.dll 25-Feb-2003 14:11  2000.80.777.0      29,244  Ssmslpcn.dll 25-Feb-2003 14:11  2000.80.777.0      82,492  Ssnetlib.dll 17-Mar-2003 01:19                    727,132  Sysmessages.sym 27-Feb-2003 12:04  2000.80.778.0      98,872  Xpweb70.dll Note Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.



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 Microsoft SQL Server 2000 Service Pack 4.



MORE INFORMATION
This problem does not occur with all queries that perform joins between multiple tables. The SQL Server query optimizer chooses the join strategy after it analyzes the indexes and the references for the joined tables that are in the query. The SQL Server query optimizer choses a star join strategy only if the star join is considered the most optimal join strategy. Therefore, this problem will not occur with most queries that involve joins between multiple tables because a star join is not a common strategy for the SQL Server query optimizer to use.

However, the execution plan of a query does not provide any information about whether the SQL Server query optimizer chose the star join strategy to join the tables in the query.

Keywords: kbbug kbfix kbtsql kbqfe kbschema kbdatabase kbsqlserv2000presp4fix kbtable kbquery kbhotfixserver KB817186

-

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

© Microsoft Corporation. All rights reserved.