Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @spid INT
- DECLARE @locktype NVARCHAR(60)
- DECLARE @lockmode NVARCHAR(60)
- DECLARE @indexname SYSNAME
- DECLARE @tablename SYSNAME
- --Following spid is related to DML process running on subscriber related to publication showing error
- SELECT @spid = 69
- SELECT @locktype = L.resource_type
- ,@lockmode = L.request_mode
- ,@indexname = I.NAME
- ,@tablename = OBJECT_NAME(I.object_id)
- FROM sys.dm_tran_locks L
- JOIN sys.partitions P ON P.hobt_id = L.resource_associated_entity_id
- JOIN sys.indexes I ON I.object_id = P.object_id
- AND I.index_id = P.index_id
- WHERE L.request_status = 'WAIT'
- AND L.request_session_id = @spid
- RAISERROR (
- 21870
- ,10
- ,0
- ,@spid
- ,@locktype
- ,@lockmode
- ,@indexname
- ,@tablename
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement