15 September,2012 by Tom Collins
I use this query to get list of queries executing on the current SQL Server including the query text
The sys.dm_exec_requests DMV returns a list of executing requests on SQL Server. To view the SQL code , there’s a reference to sys.dm_exec_sql_text which returns the text base don the sql_handle.
Use the query to get a quick overview of any slow running queries . Then drill down into the request to see why it’s causing a problem. Such as SQL Server – sys.dm_exec_sessions and troubleshooting sql memory usage
SELECT r.session_id, s.TEXT, r.[status], r.blocking_session_id, r.cpu_time, r.total_elapsed_time FROM sys.dm_exec_requests r CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s
Top 5 SQL Server DMV for Index Analysis
SQL Server - Find all DMV and DMF
SQL Server sql_handle returns sql statement
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |