SELECT req.session_id ,blocking_session_id ,ses.host_name ,DB_NAME(req.database_id) AS DB_NAME ,ses.login_name ,req.status ,req.command ,req.start_time ,req.cpu_time ,req.total_elapsed_time / 1000.0 AS total_elapsed_time ,req.command ,req.wait_type ,sqltext.text FROM sys.dm_exec_requests req CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext JOIN sys.dm_exec_sessions ses ON ses.session_id = req.session_id WHERE req.wait_type IS NOT NULL --WHERE req.wait_type = '?'
SELECT /* MONITOR */ s2.text, session_id, start_time, STATUS, cpu_time, blocking_session_id, wait_type, wait_time, wait_resource, open_transaction_count FROM sys.dm_exec_requests a CROSS APPLY sys.dm_exec_sql_text(a.sql_handle) AS s2 WHERE STATUS <> 'background';