/* Processes that are blocking others */
select * from
sysprocesses
where spid in
(
select
blocked
from
syslocks l
inner join sysprocesses p on p.spid=l.spid
where
p.dbid=5 -- Database ID
and p.blocked<>0
)
/* Processes being blocked*/
select
p.*
from
syslocks l
inner join sysprocesses p on p.spid=l.spid
where
p.dbid=5
and p.blocked<>0