Check which Query is currently running on SQL Server

Hi Folks,

Today I am sharing a pretty useful query often required when to many user’s are working on same server

and one query might be blocking another and we want to see which queries were the culprits,you can fire

the below and query and check the currently running queries on your server.

USE master
GO
SELECT DB_NAME(database_id) AS [Database], [text] AS [Query]
FROM sys.dm_exec_requests r
CROSS APPLY sys.dm_exec_sql_text(r.plan_handle) st
WHERE session_Id > 50           — Consider spids for users only, no system spids.
AND session_Id NOT IN (@@SPID)  — Don’t include request from current spid.

 

Sample output:

image

I would like to have feedback from my blog readers.

Please post your feedback, question, or comments about this article.