TABLE 1 Input Parameters for sp_who1
Parameter Data Type Description
@spidpool varchar (500) Contains one or more SPIDs separated by commas. Space is allowed around SPIDs. No other characters or symbols are allowed. Zeros preceding a SPID are ignored. A valid SPID is between 1 and 32767.
Null—Check all SPIDs.
Not null—Check the specified SPID or pool of SPIDs.
@status sysname Process status such as sleeping, runnable, or background.
Null—Check all statuses.
Not null—Check the processes with the status.
@loginame sysname SQL Server login or Windows login. Windows account should be prefixed with "domain\" and quoted in brackets ([]) or single quote marks (' ').
Null—Check all logins.
Not null—Check the connections established under the specified login names.
@command sysname Command currently executing, such as SELECT, INSERT, or BACKUP DATABASE.
Null—Check all commands.
Not null—Check the specified command only.
@dbname sysname Database name.
Null—Check connections in all databases.
Not null—Check processes running in the specified database.
@hostname sysname Name of the machine from which the connection originated.
Null—Check connections from all machines.
Not null—Check processes coming from the specified machine name.
@waittime int The length of time in milliseconds the SPID has been waiting.
Null—Check all processes, regardless of whether they're waiting.
0—Check waiting processes (waittype > 0x0000).
> 0—Check processes that have been waiting for longer than the specified time.
@lastbatch datetime The last time a client process executed a batch. Can be any valid datetime format.
Null—Check batches running at all times.
Not null—Check those connections that last ran at or later than the given time.
@program sysname Application name under which the process is running.
Null—Check all programs.
Not null—Check only the processes running under the specified application.
@opentran int The number of open transactions.
Null—Check all processes regardless of whether there are open transactions.
Not null—Check processes that have open transactions equal to or greater than the specified number.
@blocked bit A flag indicating whether a block needs to be checked or filtered.
Null—Don't bother checking on blocks.
Not null—Check blocks.
0—List processes not currently affected by blocking.
1—List only blocked processes. Also, trace the head of the blocking chain.