FIX: ORDER BY DESC Query After Update Brings Error 1203

ID: Q176491


The information in this article applies to:

BUG #: 17495 (6.5)

SYMPTOMS

If you run an ORDER BY DESC query after an UPDATE on the same table in a transaction, you may receive the following error message:

Caller of lock manager is incorrectly trying to unlock an unlocked object. spid=%d locktype=%d dbid=%d lockid=%Id
This problem occurs if all of the following conditions are true: This is a regression starting with SQL Server 6.5 Service Pack 2.


WORKAROUND

To work around this problem, do any one of the following:


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 6.5. This problem has been corrected in U.S. Service Pack 5a for Microsoft SQL Server version 6.5. For information about downloading and installing the latest SQL Server Service Pack, see http://support.microsoft.com/support/sql/.

For more information, contact your primary support provider.


MORE INFORMATION

Steps to Reproduce the Problem

The following script will demonstrate the problem:

drop table test
go
create table test (c1 smallint,c2 varchar(200),c3 char(250),c4 int)
go

/* Create sample data */ 
declare @wert int
select @wert = 1

while @wert < 12
begin
 insert test values
(1,convert(varchar(200),@wert),convert(char(250),@wert),@wert)
 insert test values
(0,convert(varchar(200),@wert+1),convert(char(250),@wert+1),@wert+1)
 select @wert = @wert + 2
end
go
create unique clustered index CL_IND ON test (c1, c2)
go
create nonclustered index NCL_IND on test (c4)
go


BEGIN TRANSACTION
update test set c3 = "X" where c4 = 9
select * from test where c1 = 1 order by c1 DESC
COMMIT TRANSACTION 

Additional query words: sp sp2 sp3


Keywords          : kbusage SSrvGen kbbug6.50 kbbug6.50.sp2 kbbug6.50.sp3 kbfix6.50.SP5 
Version           : 
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 14, 1999