Table of Contents

Class CompatibilitySchema.Process

Namespace
LinqToDB.Tools.DataProvider.SqlServer.Schemas
Assembly
linq2db.Tools.dll

sys.sysprocesses (Transact-SQL)

Applies to: √ SQL Server (all supported versions)

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.

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.


See sys.sysprocesses.

[Table(Schema = "sys", Name = "sysprocesses", IsView = true)]
public class CompatibilitySchema.Process
Inheritance
CompatibilitySchema.Process
Extension Methods

Properties

Blocked

ID 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.

[Column("blocked")]
[NotNull]
public short Blocked { get; set; }

Property Value

short

Cmd

Command currently being executed.

[Column("cmd")]
[NotNull]
public string Cmd { get; set; }

Property Value

string

ContextInfo

Data stored in a batch by using the SET CONTEXT_INFO statement.

[Column("context_info")]
[NotNull]
public byte[] ContextInfo { get; set; }

Property Value

byte[]

Cpu

Cumulative CPU time for the process. The entry is updated for all processes, regardless of whether the SET STATISTICS TIME option is ON or OFF.

[Column("cpu")]
[NotNull]
public int Cpu { get; set; }

Property Value

int

DbID

ID of the database currently being used by the process.

[Column("dbid")]
[NotNull]
public short DbID { get; set; }

Property Value

short

Ecid

Execution context ID used to uniquely identify the subthreads operating on behalf of a single process.

[Column("ecid")]
[NotNull]
public short Ecid { get; set; }

Property Value

short

Hostname

Name of the workstation.

[Column("hostname")]
[NotNull]
public string Hostname { get; set; }

Property Value

string

Hostprocess

Workstation process ID number.

[Column("hostprocess")]
[NotNull]
public string Hostprocess { get; set; }

Property Value

string

Kpid

Windows thread ID.

[Column("kpid")]
[NotNull]
public short Kpid { get; set; }

Property Value

short

LastBatch

Last time a client process executed a remote stored procedure call or an EXECUTE statement.

[Column("last_batch")]
[NotNull]
public DateTime LastBatch { get; set; }

Property Value

DateTime

Lastwaittype

A string indicating the name of the last or current wait type.

[Column("lastwaittype")]
[NotNull]
public string Lastwaittype { get; set; }

Property Value

string

LoginTime

Time at which a client process logged into the server.

[Column("login_time")]
[NotNull]
public DateTime LoginTime { get; set; }

Property Value

DateTime

Loginame

Login name.

[Column("loginame")]
[NotNull]
public string Loginame { get; set; }

Property Value

string

Memusage

Number 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.

[Column("memusage")]
[NotNull]
public int Memusage { get; set; }

Property Value

int

NetAddress

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.

[Column("net_address")]
[NotNull]
public string NetAddress { get; set; }

Property Value

string

NetLibrary

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.

[Column("net_library")]
[NotNull]
public string NetLibrary { get; set; }

Property Value

string

NtDomain

Windows domain for the client, if using Windows Authentication, or a trusted connection.

[Column("nt_domain")]
[NotNull]
public string NtDomain { get; set; }

Property Value

string

NtUsername

Windows user name for the process, if using Windows Authentication, or a trusted connection.

[Column("nt_username")]
[NotNull]
public string NtUsername { get; set; }

Property Value

string

OpenTran

Number of open transactions for the process.

[Column("open_tran")]
[NotNull]
public short OpenTran { get; set; }

Property Value

short

PageResource

Applies to: SQL Server 2019 (15.x)

An 8-byte hexadecimal representation of the page resource if the waitresource column contains a page.

[Column("page_resource")]
[Nullable]
public byte[]? PageResource { get; set; }

Property Value

byte[]

PhysicalIo

Cumulative disk reads and writes for the process.

[Column("physical_io")]
[NotNull]
public long PhysicalIo { get; set; }

Property Value

long

ProgramName

Name of the application program.

[Column("program_name")]
[NotNull]
public string ProgramName { get; set; }

Property Value

string

RequestID

ID of request. Used to identify requests running in a specific session.

[Column("request_id")]
[NotNull]
public int RequestID { get; set; }

Property Value

int

SID

Globally unique identifier (GUID) for the user.

[Column("sid")]
[NotNull]
public byte[] SID { get; set; }

Property Value

byte[]

Spid

SQL Server session ID.

[Column("spid")]
[NotNull]
public short Spid { get; set; }

Property Value

short

SqlHandle

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.

[Column("sql_handle")]
[NotNull]
public byte[] SqlHandle { get; set; }

Property Value

byte[]

Status

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.

[Column("status")]
[NotNull]
public string Status { get; set; }

Property Value

string

StmtEnd

Ending 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.

[Column("stmt_end")]
[NotNull]
public int StmtEnd { get; set; }

Property Value

int

StmtStart

Starting offset of the current SQL statement for the specified sql_handle.

[Column("stmt_start")]
[NotNull]
public int StmtStart { get; set; }

Property Value

int

UID

ID of the user that executed the command. Overflows or returns NULL if the number of users and roles exceeds 32,767.

[Column("uid")]
[Nullable]
public short? UID { get; set; }

Property Value

short?

Waitresource

Textual representation of a lock resource.

[Column("waitresource")]
[NotNull]
public string Waitresource { get; set; }

Property Value

string

Waittime

Current wait time in milliseconds.

0 = Process is not waiting.

[Column("waittime")]
[NotNull]
public long Waittime { get; set; }

Property Value

long

Waittype

Reserved.

[Column("waittype")]
[NotNull]
public byte[] Waittype { get; set; }

Property Value

byte[]