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

Article translations Article translations
Article ID: 293484 - View products that this article applies to.
This article was previously published under Q293484
BUG #: 352793 (SHILOH_bugs)
Expand all | Collapse all

On This Page

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.

MORE INFORMATION

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

				

Properties

Article ID: 293484 - Last Review: November 5, 2003 - Revision: 3.2
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbbug kbfix kbsqlserv2000sp1fix KB293484

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com