If you want to find currently running SQL Query in SQL Server, you can use the Dynamic Management View dm_exec_requests in SQL Server 2005 and later.
How to Find Currently Running Query in SQL Server ?
This returns the record for each request that is currently executing. You can display the actual SQL that is executing by doing a cross apply to sys.dm_exec_sql_text.
Below is a sample SQL query that finds the currently running Query in SQL Server.
SELECT SQLT.TEXT, REQ.session_id, REQ.status, REQ.command, REQ.cpu_time, REQ.total_elapsed_time FROM sys.dm_exec_requests AS REQ CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS SQLT
Enter your email address to subscribe to this blog and receive notifications of new posts by email.