1 Version 4.0 -- 1/15/89 sp_who
______________________________________________________________________
NAME: sp_who
FUNCTION:
Reports information on current SQL Server users and processes.
SYNTAX:
sp_who [loginame | "spid"]
EXAMPLES:
1) sp_who
Reports on the processes that are running on SQL Server:
sp_who Version 4.0 -- 1/15/89 2
______________________________________________________________________
spid status loginame hostname blk dbname cmd
---- ---------- --------- ---------- --- --------- ----------------
1 sleeping sa plum 0 pubs AWAITING COMMAND
2 sleeping sa 0 master NETWORK HANDLER
3 sleeping sa 0 master CHECKPOINT SLEEP
4 sleeping karenp plum 1 pubs SELECT
5 runnable karenp plum 0 pubs SELECT
(5 rows affected)
The spid column contains process identification numbers, used
in the Transact-SQL KILL command. The blk column contains
the process ID's of the blocking process, if there is one. A
blocking process (which may be infected or have an exclusive
lock) is one that is holding resources that another process
needs. In the previous example, process 4 (a SELECT on a
table) is blocked by process 1 (a BEGIN TRANsaction followed
3 Version 4.0 -- 1/15/89 sp_who
______________________________________________________________________
by in INSERT on the same table).
If you enable mirrored disks or remote procedure calls, the
mirror handler and the site handler will also show up in the
report from sp_who.
2) sp_who victoria
Reports on the processes the user victoria is running.
3) sp_who "17"
Reports on what SQL Server process number 17 is up to.
PARAMETERS:
loginame - is the user's login name on SQL Server. If no name
is specified, the procedure reports on all active users of
sp_who Version 4.0 -- 1/15/89 4
______________________________________________________________________
SQL Server.
spid - is the number of a specific process. You can supply a
process number as a parameter if you enclose it in quotes
(SQL Server is expecting a char type).
COMMENTS:
o Executing sp_who reports information on a specified user, on a
specified SQL Server process, or on all users currently running
a process on SQL Server.
o Without parameters, the procedure reports which users are run-
ning what processes in all databases.
o The System Administrator can remove infected processes with the
KILL command.
MESSAGES:
The name supplied for the loginame parameter does not exist on
5 Version 4.0 -- 1/15/89 sp_who
______________________________________________________________________
SQL Server.
PERMISSIONS:
Execute permission to public.
TABLES USED:
sysprocesses
SEE ALSO:
sp_lock, KILL