If there are blocking sessions, this query will help you identify the session that causes the first blocking condition.
select Blocking.spid as HeadOfBlockingChain
from master.dbo.sysprocesses Blocking inner join master.dbo.sysprocesses Blocked
on Blocking.spid = Blocked.Blocked
where Blocking.Blocked = 0
Then you can use dynamic views or use dbcc inputbuffer to get the query text.
dbcc inputbuffer(53)
In another post I will show you how to get both the blocker and blocked spids and their query text using dynamic views.
This query es very useful...everyday!
ReplyDelete