Article ID: 201909
Article Last Modified on 10/16/2003
Use Pubs
go
Create table test(
id int,
name char(10))
go
create clustered index test_index on test(id) go
insert test values (1, 'sample1') insert test values (2, 'sample2') insert test values (3, 'sample3') insert test values (4, 'sample4') insert test values (5, 'sample5') go
Begin tran select name from test where id between 3 and 5 goYou receive the following output, as expected:
name ---------- sample3 sample4 sample5
sp_lock @@spid go
spid dbid ObjId IndId Type Resource Mode Status ------ ------ ----------- ------ ---- ---------------- -------- ------ 54 5 0 0 DB S GRANTwhere the output indicates that there are no IS page locks held on the data pages of the table as expected.
begin tran update test set id = 10 where id = 5 go
Begin tran select name from test where id between 3 and 5 go
rollback transaction go
sp_lock @@spid goThe output from sp_lock for the particular SPID 8, on database pubs with a DBID of 5 from connection C2 is:
spid dbid ObjId IndId Type Resource Mode Status ---- ---- --------- ------ ---- -------- ---- ------ 8 5 165575628 1 PAG 1:96 IS GRANT 8 5 0 0 DB S GRANTThe actual SPID and DBID may vary from case to case.
Keywords: kbbug kbpending KB201909