Thursday, 21 June 2018

How to check sub query running through any session id

SELECT  SUBSTRING(detail.text,
                  requests.statement_start_offset / 2,
                  (requests.statement_end_offset - requests.statement_start_offset) / 2)
FROM    sys.dm_exec_requests requests
CROSS APPLY sys.dm_exec_sql_text (requests.plan_handle) detail
WHERE   requests.session_id = 2534

No comments:

Post a Comment

CPU queries in SQL server

-- Database Wise CPU Utilization report -- CPU_Time(Ms): CPU Time in Milliseconds -- CPUPercent: Let’s say this instance is using 50% CP...