Return status information for specified Open Server threads.
server_name... sp_who [loginame | ’spid’]
The user’s login name.
The internal identification number of the thread to report on. The spid can be obtained from the output of a previous sp_ps or sp_who call. If no spid is specified, all threads are listed.
This example shows output from the sp_who procedure.
1>DCSERVER...sp_who
2>go
spid status loginame hostname blk cmd
-------- ---------- ------------ ---------- --- ----------------
1 runnable 0 NETWORK HANDLER
2 sleeping 0 CONNECT HANDLER
3 sleeping 0 DEFERRED HANDLER
4 runnable 0 SCHEDULER
11 sleeping hiram 0
14 running bud sonoma 0
In this example, the output columns are as follows:
loginame – the name of the logged in user. Applies only to client threads.
hostname – for a client task, this is the name of the client’s machine. For a site handler thread, it is the name of the remote Adaptive Server.
blk – this field is unused and is always set to 0.
cmd – a character string that describes the state of the thread. The contents of this column are set by the srv_thead_props routine.
sp_who reports status information about a specified server thread or all current Open Server threads.
The output from the sp_who system registered procedure matches the output from the Adaptive Server sp_who system procedure.
sp_who returns a subset of the information that sp_ps returns.
loginame and spid are character string parameters. When using isql to execute sp_who as a remote procedure call from an Adaptive Server, surround the spid in quotes to avoid a syntax error.
If you do not specify loginame or spid, sp_who lists all current threads.
sp_who returns the following information:
spid – the internal thread number of the thread.
status – the current status of the thread. The values for this column are:
running
runnable
sleeping
sick
free
stopped
spawned
terminal
unknown
The one “running” task is the thread that is executing sp_who.
The following table summarizes the results returned as rows with these columns:
Column name |
Datatype |
Length |
---|---|---|
spid |
CS_INT_TYPE |
4 |
status |
CS_CHAR_TYPE |
10 |
loginame |
CS_CHAR_TYPE |
12 |
hostname |
CS_CHAR_TYPE |
10 |
blk |
CS_INT_TYPE |
3 |
cmd |
CS_CHAR_TYPE |
16 |