SHARE
TWEET

Lock Banco

leandropintor Jan 3rd, 2020 221 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  SELECT
  2.  
  3.         L.request_session_id AS SPID,
  4.         DB_NAME(L.resource_database_id) AS DatabaseName,
  5.         O.Name AS LockedObjectName,
  6.         P.object_id AS LockedObjectId,
  7.         L.resource_type AS LockedResource,
  8.         L.request_mode AS LockType,
  9.         ST.text AS SqlStatementText,      
  10.         ES.login_name AS LoginName,
  11.         ES.host_name AS HostName,
  12.         TST.is_user_transaction as IsUserTransaction,
  13.         AT.name as TransactionName,
  14.         CN.auth_scheme as AuthenticationMethod
  15. FROM  
  16.   sys.dm_tran_locks L
  17.         JOIN sys.partitions P ON P.hobt_id = L.resource_associated_entity_id
  18.         JOIN sys.objects O ON O.object_id = P.object_id
  19.         JOIN sys.dm_exec_sessions ES ON ES.session_id = L.request_session_id
  20.         JOIN sys.dm_tran_session_transactions TST ON ES.session_id = TST.session_id
  21.         JOIN sys.dm_tran_active_transactions AT ON TST.transaction_id = AT.transaction_id
  22.         JOIN sys.dm_exec_connections CN ON CN.session_id = ES.session_id
  23.         CROSS APPLY sys.dm_exec_sql_text(CN.most_recent_sql_handle) AS ST
  24. WHERE  
  25.   resource_database_id = db_id()
  26. ORDER BY
  27.   L.request_session_id
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top