Created
November 10, 2011 14:35
-
-
Save slabad/1354977 to your computer and use it in GitHub Desktop.
TSQL: FindBlockingChain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
SPID | |
,Status | |
,loginame | |
,HostName | |
,blocked | |
,open_tran | |
,waittype | |
,cmd | |
,Last_Batch | |
,text | |
,lastwaittype | |
,waitresource | |
,cpu | |
,physical_io | |
,t.dbid | |
,Program_Name | |
,hostprocess | |
,sql_handle | |
from sys.sysprocesses | |
CROSS APPLY sys.dm_exec_sql_text(sql_handle) t | |
WHERE SPID in (select Blocked from master..sysprocesses where cast(blocked as varchar(20)) <> ' .') | |
--and open_tran > 0 | |
order by blocked |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment