Util para detectar Dead locks.
SELECT
/*req_spid As spid,rsc_dbid As dbid,
rsc_objid As ObjId,
rsc_indid As IndId,
*/ p.loginame As [SqlUser],p.nt_username As [WinUser],p.program_name As [Client],p.hostname As [Host] ,p.cmd As [SqlCommand],p.status AS [Status],db_name(rsc_dbid) As [Database],object_name(rsc_objid) As [object],
substring (v.name, 1, 4) As [Type],
substring (rsc_text, 1, 16) As [Resource],substring (u.name, 1, 8) As [Mode],substring (x.name, 1, 5) As [Status],p.net_library AS [net_library]FROMmaster.dbo.syslockinfo with(nolock),
master.dbo.spt_values v with(nolock),
master.dbo.spt_values x with(nolock),master.dbo.spt_values u with(nolock),master.dbo.sysprocesses p with(nolock)WHERE p.spid=req_spidand master.dbo.syslockinfo.rsc_type = v.numberand v.type = 'LR'and master.dbo.syslockinfo.req_status = x.numberand x.type = 'LS'and master.dbo.syslockinfo.req_mode + 1 = u.numberand u.type = 'L'and object_name(rsc_objid) is not null
ORDER BY spid, object, Type