FIX: Incorrect Record is Deleted or Updated When a Clustered Index is in Descending Order
This article was previously published under Q293484
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 352793 (SHILOH_bugs)
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.
The UPDATE and DELETE code is not accounting for the descending columns in the indexes.
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 theMicrosoft Knowledge Base:
290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack
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 BehaviorTo reproduce this problem run the following script:
use tempdbgoCREATE TABLE [dbo].[test] ( [ID] [int] NOT NULL , [T] [varchar] (50) NULL)GOCREATE CLUSTERED INDEX [IX_test] ON [dbo].[test]([ID] DESC )GOINSERT 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 recordDELETEFROM [test]WHERE [ID] > 50SELECT * FROM [test]-- clean updrop table dbo.testgo
Article ID: 293484 - Last Review: 01/16/2015 22:05:17 - Revision: 3.2
Microsoft SQL Server 2000 Standard Edition
- kbnosurvey kbarchive kbbug kbfix kbsqlserv2000sp1fix KB293484