select a.spid blocking_spid,a.blocked,c.text blocking_text,d.text blocked_text
from sys.sysprocesses a with(nolock)
left join sys.sysprocesses b with(nolock) on a.blocked=b.spid
cross apply sys.dm_exec_sql_text(a.sql_handle) c
cross apply sys.dm_exec_sql_text(b.sql_handle) d
where a.blocked<>0
通过以上语句可以查看数据库哪些执行的sql死锁了