Introduction
sp_who2 is a undocumented thus unsupported stroed procedure in SQL server, but widely used inststed of sp_who to list processes currently active in SQL Server. Both these procudures are designed to retrive same result set, however sp_who2 adds some extra columns which sp_who does not include. Furthermore, sp_who2 makes an effort to make the display to be as compact as possible for output in text mode.
sp_who2 usually helps me to track / kill deadlocks in my database.
Using the code
The result set of sp_who2 will contains a column named BlkBy, this represents the SPID that is currently stopping the SPID in the row.
Sometimes many rows will show SPID numbers in the BlkBy column.
This is because there is a chain of blockers. The way this occurs usually starts with one “lead blocker” blocking another process.=