Find blocking queries in MSSQL

To find queries that block others in Microsoft SQL databases, execute

select session_id,command,wait_type,blocking_session_id from sys.dm_exec_requests;

This returns the list of active sessions and indicates what session blocked it.

To get the query of a session, execute

dbcc inputbuffer(THE_SESSION_ID)

Leave a comment

Your email address will not be published. Required fields are marked *