Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. DECLARE @spid INT
  2. DECLARE @locktype NVARCHAR(60)
  3. DECLARE @lockmode NVARCHAR(60)
  4. DECLARE @indexname SYSNAME
  5. DECLARE @tablename SYSNAME
  6. --Following spid is related to DML process running on subscriber related to publication showing error
  7. SELECT @spid = 69
  8. SELECT @locktype = L.resource_type
  9. ,@lockmode = L.request_mode
  10. ,@indexname = I.NAME
  11. ,@tablename = OBJECT_NAME(I.object_id)
  12. FROM sys.dm_tran_locks L
  13. JOIN sys.partitions P ON P.hobt_id = L.resource_associated_entity_id
  14. JOIN sys.indexes I ON I.object_id = P.object_id
  15. AND I.index_id = P.index_id
  16. WHERE L.request_status = 'WAIT'
  17. AND L.request_session_id = @spid
  18.  
  19. RAISERROR (
  20. 21870
  21. ,10
  22. ,0
  23. ,@spid
  24. ,@locktype
  25. ,@lockmode
  26. ,@indexname
  27. ,@tablename
  28. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement