select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'orderby tablename;
select blocked
from(select*from sysprocesses where blocked>0) a
wherenotexists(select*from(select*from sysprocesses where blocked>0) b
where a.blocked=spid);--查死锁进程select dbid,*from sys.sysprocesses
where1=1--and spid >50and blocked <>0;
查看死锁的语句
dbcc inputbuffer(会话id);
查看正在执行的语句
SELECT*FROM sys.dm_exec_requests r
CROSSAPPLY sys.dm_exec_sql_text(r.sql_handle) t;