摘要:
SELECT 0 ,blocked FROM (SELECT * FROM sys.sysprocesses WHERE blocked>0 ) a WHERE NOT EXISTS(SELECT * FROM (SELECT * FROM sys.sysprocesses WHERE blocked>0 ) b WHERE a.blocked=spid) UNION SELECT spid,blocked FROM sys.sysprocesses WHERE blocked>0使用查询后的进程ID可以查看死锁元凶的Sql语句和被牺牲Sql语句。DBCC INPUTBUFF 阅读全文