Using sp_who
-
Posted on June 20, 2010 by Derek Dieter
-
1
sp_who is a system stored procedure designed to return back information regarding the current sessions in the database. These sessions are commonly referred to as SPIDS (Server Process ID’s). While sp_who is sometimes used, it’s sister procedure sp_who2 is used far more often. This is because sp_who2 returns back more information than sp_who.
Let’s look at a comparison. sp_who, and sp_who2 both have one optional parameter which is the session id. If you do not pass a session ID, then all sessions are returned. In order to execute, simply copy the text below.
[cc lang=”sql”]
— execute sp_who
EXEC sp_who
— execute sp_who2
EXEC sp_who2
[/cc]
From these results we see that sp_who contains the DiskIO, CPUTime and ProgramName. There is essentially no reason why you would want to execute sp_who over sp_who2.
- Comments (RSS)
- Trackback
- Permalink