T-SQL – Checking Users and Processes Details
If you want to check quickly what all processes are being run or which user is running what process, what is the cause of blocked processes and etc., and then sp_who or sp_who2 commands are very helpful.
sp_who provides below details:
- System process ID.
- Status of the process.
- Login name of the user.
- Name of the user.
- If the process is blocked, the SPID of the blocking process.
- Database the process is using.
- Command currently being executed.
sp_who2 provides additional information like:
- Total CPU time of each process.
- Total amount of disk reads for each process.
- Last time a client called a procedure or executed a query.
- Application connected.