Microsoft KB Archive/290817
Article ID: 290817
Article Last Modified on 10/7/2005
- Microsoft SQL Server 2000 Standard Edition
- Microsoft SQL Server 7.0 Standard Edition
This article was previously published under Q290817
BUG #: 352229 (SHILOH)
BUG #: 101227 (SQLBUG_70)
If you submit a query that contains an aggregate or other computed column inside of a subquery, SQL Server may return error 8624 while attempting to optimize the query. The error message is:
The query will not run, and it is not possible to see the SHOWPLAN_ALL or SHOWPLAN_TEXT output for the query.
Service pack information
To resolve this problem, obtain the latest service pack for 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
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 SQL Server 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.
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.
Version File name ---------------------- 8.00.0258 S80258i.exe
Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.
If the computed expression is a MIN(<column>) or MAX(<column>) aggregate, you can replace the aggregate with a TOP 1 <column> ... ORDER BY <column> ASC or ORDER BY <column> DESC clause, respectively.
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.
The state reported in the error message indicates where in the code that this particular error occurs. For example, the state for this error is eight (8). This particular fix only addresses 8624 errors where the state is eight.
The following code sample demonstrates the problem, as well as the suggested workaround of using TOP.
create table t (schedule nvarchar(3), lastdateentry smalldatetime, mileage char(1)) create table t1 (service_method varchar(3), transport_indicator varchar(1)) create table t2 (service_method varchar(3), transport_indicator varchar(1)) go create view v as select service_method, transport_indicator from t1 UNION all select service_method, transport_indicator from t2 go --This query returns error 8624 SELECT Count(*) FROM t join v on t.Schedule = v.Service_Method Where t.lastdateentry = (select max(lastdateentry) from t where mileage = v.transport_indicator) go --This rewritten version of the query works fine SELECT Count(*) FROM t join v on t.Schedule = v.Service_Method Where t.lastdateentry = (select top 1 lastdateentry from t where mileage = v.transport_indicator order by lastdateentry DESC)
Keywords: kbbug kbfix kbqfe kbsqlserv2000sp1fix KB290817