How to View Currently Executing Queries in SQL Server
November 12, 2009
Here’s a quick TSQL query to find the “currently executing queries” and the database name:
SELECT db.name, er.session_id, er.transaction_id, er.start_time, er.[status], er.command, er.wait_time -- etc. FROM sys.dm_exec_requests AS er JOIN sys.sysdatabases AS db ON er.database_id = db.dbid WHERE er.status = 'running'
Here’s the query in action:
Trackbacks