When deciding whether to use sp_who or sp_who2, check the table below for a detailed comparison list.
The main difference between the two commands is this:
sp_who is documented and officially supported.
sp_who2 is undocumented and therefore unsupported but commonly used.
As you can see on the comparison table below, they both basically return the same information but sp_who2 includes some extra columns:
sp_who | sp_who2 | ||
spid | System process id | SPID | System process id |
ecid | Execution context of the thread associated with the SPID. Zero means the main thread, all other numbers mean sub-threads. | ||
status | Runnable, sleeping, or background. If the status is runnable that means the process is actually performing work, sleeping means the process is connected to the server, but is idle at the moment. | Status | Runnable, sleeping, or background. If the status is runnable that means the process is actually performing work, sleeping means the process is connected to the server, but is idle at the moment. |
loginame | The login name of a user | Login | The login name of the user |
hostname | Computer name of the user. | HostName | Computer name of the user. |
blk | The SPID of the connection that is blocking the current connection | BlkBy | The SPID of the connection that is blocking the current connection |
dbname | The database name where process is running | DBName | The database name where process is running |
cmd | General command type currently being executed | Command | General command type currently being executed |
CPUTime | The number of milliseconds the request has used | ||
DiskIO | Disk input / output that the command has used | ||
LastBatch | Date and time of the last batch executed by the connection | ||
ProgramName | The name of the application that connected with | ||
SPID | Same SPID repeated at the end of the file for right-scrolling users |
Microsoft Docs web site for sp_who:
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-who-transact-sql
Link to my newly blog on: How to filter sp_who2 in SQL Server Instance