sp_who

Reports information about all current SAP ASE users and processes or about a particular user or process. Includes the thread_pool column, which describes the thread pool the SAP ASE server uses to execute a task.

Considerations for process mode

sp_who does not include the threadpool column.

Syntax

sp_who [loginame | "spid"]

Parameters

Examples

Usage

There are additional considerations when using sp_who:
  • sp_who reports information about a specified user or the SAP ASE server process.

  • Without parameters, sp_who reports which users are running what processes in all databases.

  • The columns returned by sp_who are:
    • fid – Identifies the family (including the coordinating process and its worker processes) to which a lock belongs. For more information, see sp_familylock.
    • spid – Identifies the process number. A system administrator can use this number with the Transact-SQL kill command to stop the process.
    • status – Indicates whether the process is running or sleeping.
    • loginame – The login or alias of the user who started the process. For all system processes, loginame is NULL.
    • origname – If the loginame is an alias, origname shows the real login name. If not, origname shows the same information as loginame.
    • hostname – The name of the server on which the database resides.
    • blk_spid – Contains the process IDs 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 needed by another process.
    • dbname – Indicates the name of the database on which the process is running.
    • tempdb – Temporary database assigned to the session.
    • cmd – Identifies the command or process currently being executed. Evaluation of a conditional statement, such as an if or while loop, returns cond.
    • block_xloid – Identifies the unique lock owner ID of a blocking transaction.
    • threadpool – Thread pool the task uses.
  • Running sp_who on a single-engine server shows the sp_who process currently running and all other processes that are runnable or in one of the sleep states. In multiengine servers, there can be a “running” process for each engine.

  • If you enable mirrored disks or remote procedure calls, the mirror handler and the site handler also appear in the report from sp_who.

See also kill in Reference Manual: Commands.

Permissions

Any user can execute sp_who. Permission checks do not differ based on the granular permissions settings.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_familylock
sp_lock