SP_WHO and SP_WHO2

What is SP_WHO and SP_WHO2?

Everyone who works on SQL Server may have used the system stored procedure sp_who. But very few knows about sp_who2. Because sp_who2 is not documented in msdn. Both SP_WHO and SP_WHO2 are Microsoft system stored procedures used to find the current and active session details. SP_WHO2 is similar to SP_WHO with some more details.

SP_WHO:

SP_WHO returns the below details:

Session ID
Execution context ID
Login name
Host Name
Session ID of the blocking process
Database Name
SQL Statement

Sample SP_WHO Execution:

SP_WHO

 

SP_WHO2:

SP_WHO2 will also return all the details like SP_WHO, in addition, it will return the below specified additional details. SP_WHO2 will be very helpful when you want to see the current blocking sessions along with the CPU utilization and the disc I/O usage.

CPUTime
DiskIO
LastBatch
ProgramName

 Sample SP_WHO2 Execution:

SP_WHO2

 


Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.