Quickie: How to View Currently Executing Queries in SQL Server
2009 November 12
[This is actually *stolen* from Brad McGehee Twitter Stream. I am posting it here for reference for those who might be needing it]
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:




















