Microsoft KB Archive/306374

From BetaArchive Wiki
Knowledge Base


FIX: SP1 Regression: Table Scan Chosen Over Index Seek for INSERT/SELECT Statement Against the Same Table

Article ID: 306374

Article Last Modified on 9/4/2002



APPLIES TO

  • Microsoft SQL Server 2000 Service Pack 1



This article was previously published under Q306374

BUG #: 355179 (SHILOH_BUGS)

SYMPTOMS

An INSERT/SELECT statement against the same table may fail to use an appropriate nonclustered index and perform a table scan instead of an index seek. The query takes the form of:

Insert Into Table1 (Column1, Column2, Column3, ...)
Select 104104, Column2, Column3, ...
From Table1
Where Column1 = 102
                

where the index contains Column1 as the first column. Prior to SQL Server 2000 Service Pack 1 (SP1) the optimizer would correctly use the index.

RESOLUTION

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 INF: How to Obtain the Latest SQL Server 2000 Service Pack


Hotfix

NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:

   Version      File name        Platform
   --------------------------------------
   8.00.436     Sqlservr.exe     Intel
                

NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.


WORKAROUND

To work around this problem you can either:

  • Change the index from non-clustered to clustered. -or-


  • Use an optimizer hint to specify the index.


STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000 Service Pack 1. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

Keywords: kbbug kbfix kbsqlserv2000presp2fix KB306374