Microsoft KB Archive/293484

= FIX: Incorrect Record is Deleted or Updated When a Clustered Index is in Descending Order =

Article ID: 293484

Article Last Modified on 11/5/2003

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition

-



This article was previously published under Q293484



BUG #: 352793 (SHILOH_bugs)



SYMPTOMS
The incorrect record may be updated or deleted from a table when there is a clustered index on that table in descending order. This occurs if the following conditions are met:
 * A clustered index exists on the table with at least one column descending.
 * A delete or update operation is performed against the table.
 * The delete or update operation has a WHERE clause that contains the descending column of the clustered index.
 * If it is an update operation, the columns in the clustered index are not updated. This means that other columns in the table are updated, and that the WHERE clause of this update statement still contains the descending column of the clustered index.



CAUSE
The UPDATE and DELETE code is not accounting for the descending columns in the indexes.



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



STATUS
Microsoft has confirmed that this is a problem in SQL Server 2000. This problem was first corrected in SQL Server 2000 Service Pack 1.



Steps to Reproduce Behavior
To reproduce this problem run the following script: use tempdb go

CREATE TABLE [dbo].[test] ( [ID] [int] NOT NULL,  [T] [varchar] (50) NULL ) GO

CREATE CLUSTERED  INDEX [IX_test] ON [dbo].[test]([ID] DESC ) GO

INSERT INTO [test] values (1, 'a') INSERT INTO [test] values (50, 'b') INSERT INTO [test] values (100, 'c')

SELECT * FROM [test] WHERE [ID] > 50

-- Deletes incorrect record DELETE FROM [test] WHERE [ID] > 50

SELECT * FROM [test]

-- clean up drop table dbo.test go

Keywords: kbbug kbfix kbsqlserv2000sp1fix KB293484

-

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

© Microsoft Corporation. All rights reserved.