How do I find which query is blocking others in SQL Server?
Resolved SQL
FD
Felix Dixon
November 1, 2026
2 replies
1,326 views
Reviewed by moderators
2 participants

The application hangs and I suspect a blocked query. How do I find who is blocking whom, and can I stop it?

Accepted answer
Marked as the solution to this question

Run this to see blocked sessions and who blocks them:

SELECT session_id, blocking_session_id, wait_type, wait_time, command FROM sys.dm_exec_requests WHERE blocking_session_id <> 0;

The blocking_session_id is the session at the head of the chain. Find what it runs with:

DBCC INPUTBUFFER(<session_id>);

or join sys.dm_exec_sql_text. sp_who2 also shows a BlkBy column for a quick look.

If you must stop it, use KILL <session_id>;. Be careful, because the session rolls back its open transaction, and for a large transaction the rollback can take as long as the work did. Look first at why it holds locks. An open transaction without a commit from the application is a common reason. Fix that in the code.

An application session had an open transaction for hours. Killed it and told the developer. Thanks.