sys.sysprocesses (Transact-SQL)


Contains information about processes that are running on an instance of SQL Server. These processes can be client processes or system processes. To access sysprocesses, you must be in the master database context, or you must use the master.dbo.sysprocesses three-part name.

System_CAPS_ICON_important.jpg Important

This SQL Server 2000 system table is included as a view for backward compatibility. We recommend that you use the current SQL Server system views instead. To find the equivalent system view or views, see Mapping System Tables to System Views (Transact-SQL). This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

Applies to: SQL Server (SQL Server 2008 through current version).
Column nameData typeDescription
spidsmallintSQL Server session ID.
kpidsmallintWindows thread ID.
blockedsmallintID of the session that is blocking the request. If this column is NULL, the request is not blocked, or the session information of the blocking session is not available (or cannot be identified).

-2 = The blocking resource is owned by an orphaned distributed transaction.

-3 = The blocking resource is owned by a deferred recovery transaction.

-4 = Session ID of the blocking latch owner could not be determined due to internal latch state transitions.
waittimebigintCurrent wait time in milliseconds.

0 = Process is not waiting.
lastwaittypenchar(32)A string indicating the name of the last or current wait type.
waitresourcenchar(256)Textual representation of a lock resource.
dbidsmallintID of the database currently being used by the process.
uidsmallintID of the user that executed the command. Overflows or returns NULL if the number of users and roles exceeds 32,767.
cpuintCumulative CPU time for the process. The entry is updated for all processes, regardless of whether the SET STATISTICS TIME option is ON or OFF.
physical_iobigintCumulative disk reads and writes for the process.
memusageintNumber of pages in the procedure cache that are currently allocated to this process. A negative number indicates that the process is freeing memory allocated by another process.
login_timedatetimeTime at which a client process logged into the server.
last_batchdatetimeLast time a client process executed a remote stored procedure call or an EXECUTE statement.
ecidsmallintExecution context ID used to uniquely identify the subthreads operating on behalf of a single process.
open_transmallintNumber of open transactions for the process.
statusnchar(30)Process ID status. The possible values are:

 dormant = SQL Server is resetting the session.

 running = The session is running one or more batches. When Multiple Active Result Sets (MARS) is enabled, a session can run multiple batches. For more information, see Using Multiple Active Result Sets (MARS).

 background = The session is running a background task, such as deadlock detection.

 rollback = The session has a transaction rollback in process.

 pending = The session is waiting for a worker thread to become available.

 runnable = The task in the session is in the runnable queue of a scheduler while waiting to get a time quantum.

 spinloop = The task in the session is waiting for a spinlock to become free.

 suspended = The session is waiting for an event, such as I/O, to complete.
sidbinary(86)Globally unique identifier (GUID) for the user.
hostnamenchar(128)Name of the workstation.
program_namenchar(128)Name of the application program.
hostprocessnchar(10)Workstation process ID number.
cmdnchar(16)Command currently being executed.
nt_domainnchar(128)Windows domain for the client, if using Windows Authentication, or a trusted connection.
nt_usernamenchar(128)Windows user name for the process, if using Windows Authentication, or a trusted connection.
net_addressnchar(12)Assigned unique identifier for the network adapter on the workstation of each user. When a user logs in, this identifier is inserted in the net_address column.
net_librarynchar(12)Column in which the client's network library is stored. Every client process comes in on a network connection. Network connections have a network library associated with them that enables them to make the connection.
loginamenchar(128)Login name.
context_infobinary(128)Data stored in a batch by using the SET CONTEXT_INFO statement.
sql_handlebinary(20)Represents the currently executing batch or object.

 Note This value is derived from the batch or memory address of the object. This value is not calculated by using the SQL Server hash-based algorithm.
stmt_startintStarting offset of the current SQL statement for the specified sql_handle.
stmt_endintEnding offset of the current SQL statement for the specified sql_handle.

-1 = Current statement runs to the end of the results returned by the fn_get_sql function for the specified sql_handle.
request_idintID of request. Used to identify requests running in a specific session.

If a user has VIEW SERVER STATE permission on the server, the user will see all executing sessions in the instance of SQL Server; otherwise, the user will see only the current session.

Execution Related Dynamic Management Views and Functions (Transact-SQL)
Mapping System Tables to System Views (Transact-SQL)
Compatibility Views (Transact-SQL)

Community Additions