Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found this query where RESOURCE_ASSOCIATED_ENTITY_ID is decoded and used based on resource_type, and in some cases I noticed that it cannot be decoded.</p> <pre class="lang-sql prettyprint-override"><code>/* LOCK MONITOR ON CURRENT schema connections */ Select GETDATE() as Current_Time1, es.session_id, db_name(sp.dbid) As DatabaseName, es.status, substring((Select text From sys.dm_exec_sql_text(sp.sql_handle)),1,128) As LastSQLText, es.host_name, es.login_time, es.login_name, es.program_name, Convert(float, Round((IsNull(es.cpu_time, 0.0) / 1000.00),0)) As CPU_Time_in_seconds, Convert(float, Round((IsNull(es.lock_timeout, 0.0) / 1000.00),0)) as lock_timeout_in_seconds, tl.resource_type As LockType, tl.request_mode, tl.resource_associated_entity_id, CASE WHEN tl.resource_type = 'OBJECT' THEN OBJECT_NAME(tl.resource_associated_entity_id) WHEN tl.resource_type IN ('KEY', 'PAGE', 'RID') THEN ( SELECT object_name(object_id) FROM sys.partitions ps1 WHERE ps1.hobt_id=tl.resource_associated_entity_id ) ELSE 'n.a.' END AS ObjectName, tl.request_status As LockStatus, ec.connect_time, ec.net_transport, ec.client_net_address, er.connection_id, Case er.blocking_session_id When 0 Then 'Not Blocked' When -2 Then 'Orphaned Distributed Transaction' When -3 Then 'Deferred Recovery Transaction' When -4 Then 'Latch owner not determined' Else '' End As Blocking_Type, er.wait_type, Convert(float, Round((IsNull(er.wait_time, 0.0) / 1000.00),0)) As Wait_Time_in_seconds, er.percent_complete, er.estimated_completion_time, Convert(float, Round((IsNull(er.total_elapsed_time, 0.0) / 1000.00),0)) As Total_Elapsed_Time_in_seconds, Case er.transaction_isolation_level When 0 Then 'Unspecified' When 1 Then 'ReadUncomitted' When 2 Then 'ReadCommitted' When 3 Then 'Repeatable' When 4 Then 'Serializable' When 5 Then 'Snapshot' Else '' End transaction_isolation_level From master.sys.dm_exec_sessions es Inner Join master.sys.sysprocesses sp On sp.spid = es.session_id Left Join master.sys.dm_exec_connections ec On ec.session_id = es.session_id Left Join master.sys.dm_exec_requests er On er.session_id = es.session_id Left Join master.sys.dm_tran_locks tl On tl.request_session_id = es.session_id Where es.session_id &lt;&gt; @@spid And es.session_id = es.session_id And sp.dbid = DB_ID() /* CURRENT DB TO MONITOR */ And tl.resource_type &lt;&gt; 'DATABASE'; raiserror( '- ', 10, 3 ) with nowait; WAITFOR DELAY '00:00:30'; GO 30 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload