22,302
社区成员




CREATE TABLE [dbo].[bigtable](
[col1] [int] NOT NULL,
[col2] [varchar](50) NOT NULL,
[keycol] [int] IDENTITY(1,1) NOT NULL
) ON [PRIMARY]
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
BEGIN TRAN
UPDATE bigtable SET col1 = 0 WHERE col2 = 'B';
--Monitoring the locks
-- STEP2: Monitoring the sys.dm_tran_locks view by using %%lockres%%
SELECT resource_description, resource_type, resource_associated_entity_id, request_mode
FROM sys.dm_tran_locks WHERE request_session_id = @@SPID