DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

List All Currently Running Queries

11.05.2009
| 5839 views |
  • submit to reddit
        Sql Server 2005 - List all currently running queries

Note: Run on the master table

SELECT st.text, r.session_id, r.status, r.command, r.cpu_time, r.total_elapsed_time
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS st
order by total_elapsed_time desc