Sp_who Stored Procedure in SQL Server 2012

In this article I will describe the significance of the sp_who system stored procedure.


In this article we will learn about the sp_who system Stored Procedure. The sp_who is an undocumented system Stored Procedure that is used to get the information of the current state of the SQL instance.


The sp_who system Stored Procedure also allows fast monitoring of active and inactive processes. The sp_who is a system Stored Procedure gets information about all current adaptive server users and processes as well as getting information about a specific user or process.


The syntax of the "sp_who" system Stored Procedure is as follows:

sp_who [usename][processid]

Where "username" is the name of the user to be queried and "processid" is the id of the process.


Let's see an example.

We can get information about all processes and users currently being used using the following command:



When we run the above command the output is as follows. It shows all the users being logged and databases being used.


Getting information about a specified user

We can get information about a specified user currently logged into the server using the following command:




Getting information about a specified process

We can get information about a specified process currently being processed in the server using the following command: