Article ID: 910392
Article Last Modified on 11/2/2007
APPLIES TO
- Microsoft SQL Server 2000 Standard Edition
- Microsoft SQL Server 2000 Enterprise Edition
- Microsoft SQL Server 2000 Developer Edition
- Microsoft SQL Server 2000 Personal Edition
Bug #: 473290 (SQL Server 8.0)
SUMMARY
This article describes the following about this hotfix release:
- The issues that are fixed by this hotfix package
- The prerequisites for applying this hotfix package
- Whether you must restart the computer after you apply this hotfix package
- Whether this hotfix package is replaced by any other hotfix package
- Whether you must make any registry changes after you apply this hotfix package
- The files that are contained in this hotfix package
SYMPTOMS
When you run a Transact-SQL query in Microsoft SQL Server 2000, you may receive incorrect results. You experience this problem when all the following conditions are true:
- The query contains an inner join that has a one-to-one key relationship.
- The query contains an aggregate expression or a DISTINCT keyword.
- The GROUP BY clause appears in the Showplan.
- The query contains an outer join.
- The outer join is simplified out of the query because no columns from the outer join table are referenced elsewhere in the query.
CAUSE
This problem occurs because the SQL Server query optimizer incorrectly simplifies the list of grouping columns. Therefore, the aggregate operator does not operate on the expected set of grouped columns.
RESOLUTION
The installer does not install this hotfix correctly on x64-based systems. This installation issue occurs when the following conditions are true:
- The system uses the Advanced Micro Devices (AMD) AMD64 processor architecture or the Intel Extended Memory 64 Technology (EM64T) processor architecture.
Note This issue does not occur on systems that use the Intel Itanium processor architecture.
- The system is running a 64-bit version of the Microsoft Windows Server operating system.
- The system is running a 32-bit version of SQL Server 2000.
We have corrected this installation issue in later builds of SQL Server 2000, starting with version 8.00.2244. When a customer who is running SQL Server 2000 on an x64-based system requests this hotfix, we will provide a build that includes this hotfix and that can be installed correctly on an x64-based system. The build that we provide will be version 8.00.2244 or a later version.
Hotfix information
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft SQL Server 2000 service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone 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 usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
Prerequisites
Microsoft SQL Server 2000 Service Pack 4 (SP4)
To obtain SQL Server 2000 SP4, and for a list of previous hotfixes, see the "Microsoft SQL Server 2000 Service Pack 4" section in the following Microsoft Knowledge Base article:
290211 How to obtain the most recent SQL Server 2000 service pack
Restart information
You do not have to restart the computer after you apply this hotfix. However, the hotfix installation stops and then restarts the MSSQLSERVER service.
Hotfix file information
This hotfix contains only those files that are required to correct the problem that is described in this article. This hotfix may not contain all the files that you must have to fully update a product to the latest build.
The English version of this hotfix has the file attributes (or later file attributes) 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.
SQL Server 2000, 32-bit versions
File name | File version | File size | Date | Time | Platform |
---|---|---|---|---|---|
Dtsui.dll | 2000.80.2171.0 | 1,593,344 | 04-Nov-2005 | 07:10 | x86 |
Impprov.dll | 2000.80.2171.0 | 102,400 | 04-Nov-2005 | 07:10 | x86 |
Mssdi98.dll | 8.11.50523.0 | 239,104 | 06-Jun-2005 | 22:46 | x86 |
Ntwdblib.dll | 2000.80.2171.0 | 290,816 | 04-Nov-2005 | 07:10 | x86 |
Odsole70.dll | 2000.80.2171.0 | 69,632 | 04-Nov-2005 | 07:10 | x86 |
Pfclnt80.dll | 2000.80.2171.0 | 430,080 | 04-Nov-2005 | 07:10 | x86 |
Replprov.dll | 2000.80.2171.0 | 237,568 | 04-Nov-2005 | 07:10 | x86 |
Semexec.dll | 2000.80.2171.0 | 856,064 | 04-Nov-2005 | 07:10 | x86 |
Sqlagent.exe | 2000.80.2171.0 | 323,584 | 04-Nov-2005 | 05:27 | x86 |
Sqldiag.exe | 2000.80.2171.0 | 118,784 | 04-Nov-2005 | 06:09 | x86 |
Sqldmo.dll | 2000.80.2171.0 | 4,362,240 | 04-Nov-2005 | 07:10 | x86 |
Sqlfth75.dll | 2000.80.2171.0 | 102,400 | 04-Nov-2005 | 05:33 | x86 |
Sqlservr.exe | 2000.80.2171.0 | 9,158,656 | 04-Nov-2005 | 07:10 | x86 |
Sqlsort.dll | 2000.80.2171.0 | 589,824 | 04-Nov-2005 | 07:10 | x86 |
Stardds.dll | 2000.80.2171.0 | 176,128 | 04-Nov-2005 | 07:10 | x86 |
Svrnetcn.dll | 2000.80.2171.0 | 110,592 | 04-Nov-2005 | 07:10 | x86 |
Ums.dll | 2000.80.2171.0 | 35,328 | 04-Nov-2005 | 07:10 | x86 |
Sqlevn70.rll | 2000.80.2171.0 | 45,056 | 04-Nov-2005 | 07:10 | Not Applicable |
SQL Server 2000, Itanium architecture version
File name | File version | File size | Date | Time | Platform |
---|---|---|---|---|---|
Impprov.dll | 2000.80.2171.0 | 244,736 | 04-Nov-2005 | 07:13 | IA-64 |
Mssdi98.dll | 8.11.50523.0 | 758,784 | 06-Jun-2005 | 22:46 | IA-64 |
Odsole70.dll | 2000.80.2171.0 | 150,528 | 04-Nov-2005 | 07:12 | IA-64 |
Pfclnt80.dll | 2000.80.2171.0 | 1,187,840 | 04-Nov-2005 | 07:30 | IA-64 |
Replprov.dll | 2000.80.2171.0 | 538,624 | 04-Nov-2005 | 07:19 | IA-64 |
Sqlagent.exe | 2000.80.2171.0 | 1,061,376 | 04-Nov-2005 | 07:37 | IA-64 |
Sqldiag.exe | 2000.80.2171.0 | 334,336 | 04-Nov-2005 | 07:32 | IA-64 |
Sqldmo.dll | 2000.80.2171.0 | 13,860,352 | 04-Nov-2005 | 07:41 | IA-64 |
Sqlfth75.dll | 2000.80.2171.0 | 246,784 | 04-Nov-2005 | 07:15 | IA-64 |
Sqlservr.exe | 2000.80.2171.0 | 24,921,600 | 04-Nov-2005 | 13:24 | IA-64 |
Sqlsort.dll | 2000.80.2171.0 | 617,472 | 04-Nov-2005 | 05:23 | IA-64 |
Svrnetcn.dll | 2000.80.2171.0 | 427,520 | 04-Nov-2005 | 07:27 | IA-64 |
Sqlevn70.rll | 2000.80.2171.0 | 35,328 | 04-Nov-2005 | 13:24 | Not Applicable |
Note Because of file dependencies, the most recent hotfix that contains these files may contain additional files.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
MORE INFORMATION
Steps to reproduce the problem
Create the test environment
Run the following code in SQL Query Analyzer.
USE Northwind GO CREATE TABLE [dbo].[Participant] ( [ProgramUserId] [int] NOT NULL , [ProjectId] [int] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Project] ( [ProjectId] [int] NOT NULL , [ProjectHdrId] [int] NOT NULL , [CustomerId] [int] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[ProjectHdr] ( [ProjectHdrId] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Participant] WITH NOCHECK ADD CONSTRAINT [pkParticipant_ParticipantId] PRIMARY KEY CLUSTERED ( [ProgramUserId], [ProjectId] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Project] WITH NOCHECK ADD CONSTRAINT [pkProject_ProjectId] PRIMARY KEY CLUSTERED ( [ProjectId] ) ON [PRIMARY] GO ALTER TABLE [dbo].[ProjectHdr] WITH NOCHECK ADD CONSTRAINT [pkProjectHdr_ProjectHdrId] PRIMARY KEY CLUSTERED ( [ProjectHdrId] ) ON [PRIMARY] GO CREATE UNIQUE INDEX [ixProject_CustomerId_Unique] ON [dbo].[Project]([CustomerId], [ProjectHdrId]) ON [PRIMARY] GO insert into Participant(ProgramUserId,ProjectId) values('3','8'); insert into Participant(ProgramUserId,ProjectId) values('3','74'); insert into Participant(ProgramUserId,ProjectId) values('3','1004'); insert into Participant(ProgramUserId,ProjectId) values('5','1003'); insert into Participant(ProgramUserId,ProjectId) values('7','8'); insert into Participant(ProgramUserId,ProjectId) values('7','74'); insert into Participant(ProgramUserId,ProjectId) values('7','1004'); insert into Participant(ProgramUserId,ProjectId) values('8','1003'); insert into Participant(ProgramUserId,ProjectId) values('8','1004'); GO insert into Project (ProjectId,ProjectHdrId,CustomerId) values('1','1','1'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('2','2','2'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('7','15','5'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('8','26','5'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('71','27','52'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('72','3','52'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('73','3','51'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('74','15','51'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('1003','1002','5'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('1004','1001','5'); insert into Project (ProjectId,ProjectHdrId,CustomerId) values('1014','1001','51'); GO insert into ProjectHdr(ProjectHdrId) values('1'); insert into ProjectHdr(ProjectHdrId) values('2'); insert into ProjectHdr(ProjectHdrId) values('3'); insert into ProjectHdr(ProjectHdrId) values('15'); insert into ProjectHdr(ProjectHdrId) values('26'); insert into ProjectHdr(ProjectHdrId) values('27'); insert into ProjectHdr(ProjectHdrId) values('1001'); insert into ProjectHdr(ProjectHdrId) values('1002'); GO
Analyze the problem
Run the following SQL query.
SELECT PH.ProjectHdrId, P.ProjectId FROM ProjectHdr AS PH JOIN Project AS P ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5
As expected, the query returns eight rows. Some rows are duplicates. Therefore, there are four distinct rows.
Add the DISTINCT keyword, and then run the query again.
dbcc freeproccache SELECT DISTINCT PH.ProjectHdrId, P.ProjectId FROM ProjectHdr AS PH JOIN Project AS P ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5
The result of this query should be four rows. However, only one row is returned.
Work around the problem
The following workaround returns the correct result set for the JOIN query. This query uses a temporary table and selected distinct values from the query.
dbcc freeproccache SELECT PH.ProjectHdrId, P.ProjectId INTO #temp FROM ProjectHdr AS PH JOIN Project AS P ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5 SELECT * from #temp SELECT DISTINCT * from #temp DROP TABLE #temp
If the SELECT statement in this query does not have the DISTINCT keyword, the query returns eight rows. If the SELECT statement in this query has the DISTINCT keyword, this query returns four rows.
The following query adds a "dummy condition" on the Participant table. Run this query.
dbcc freeproccache SELECT DISTINCT PH.ProjectHdrId, P.ProjectId FROM ProjectHdr AS PH JOIN Project AS P ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5 AND (PP.ProjectId IS NOT NULL OR PP.ProjectId IS NULL)
Notice that the query returns four rows.
The following query changes the order of the equi-join and enforces this order. Run this query.
dbcc freeproccache SELECT DISTINCT PH.ProjectHdrId, P.ProjectId FROM Project AS P JOIN ProjectHdr AS PH ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5 OPTION (FORCE ORDER)
Notice that the query returns four rows.
The following query drops the index Project.ixProject_CustomerId_Unique. Run this query.
drop index project.ixProject_CustomerId_Unique dbcc freeproccache SELECT DISTINCT PH.ProjectHdrId, P.ProjectId FROM ProjectHdr AS PH JOIN Project AS P ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5
Notice that the query returns four rows.
Reproduce the problem
If you re-create the index Project.ixProject_CustomerId_Unique, the problem occurs again. Run the following code to re-create the index.
create unique index ixProject_CustomerId_Unique on project (CustomerId, ProjectHdrId)
Run the following query.
dbcc freeproccache SELECT DISTINCT PH.ProjectHdrId, P.ProjectId FROM ProjectHdr AS PH JOIN Project AS P ON P.ProjectHdrId = PH.ProjectHdrId LEFT OUTER JOIN Participant AS PP ON PP.ProjectId = P.ProjectId WHERE P.CustomerId = 5
Notice that only one record is returned. However, if you run the query without the DISTINCT keyword in the SELECT statement, the query returns eight rows.
For more information about the naming schema for Microsoft SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packages
For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates
Keywords: kbprb kbtshoot kbbug kbfix kbpubtypekc kbhotfixserver kbqfe KB910392