sys.sysprocesses (Transact-SQL)
| 列名 | 
数据类型 | 
描述 | 
| spid | 
smallint | 
SQL Server 会话ID | 
| kpid | 
smallint | 
Winndows 线程ID | 
| blocked | 
smallint | 
正在阻塞请求的会话ID。如果此列未NULL,则表示请求未被阻塞,或锁定会话的会话信息不可用(或无法进行标识) | 
 | 
 | 
2:阻塞资源有孤立的分布式事务拥有。 | 
 | 
 | 
3:阻塞资源由延迟的恢复事务拥有。 | 
 | 
 | 
4:由于内部闩锁状态转换而无法确定阻塞闩锁所有者的会话 ID。 | 
| waittype | 
binary(2) | 
保留 | 
| waittime | 
bigint | 
当前等待时间(毫秒) | 
| lastwaittype | 
nchar(32) | 
上次或当前等待类型名称的字符串 | 
| waitsourece | 
ncahr(256) | 
锁定资源的文本化表示法 | 
| dbid | 
smallint | 
当前进程使用的数据库ID | 
| uid | 
smallint | 
执行命令的用户ID。如果用户数和角色(role)数超过32767,则发生溢出或返回NULL | 
| cpu | 
int | 
进程累积的CPU时间。无论SET STATISTICS TIME 选项是ON还是OFF,都为所有进程更新该项 | 
| physical_io | 
bigint | 
进程的累计磁盘独写和写入 | 
| memusage | 
int | 
为此进程分配的过程缓存中的页数。如果负数,表示进程正在释放由另一个进程分配的内存。 | 
| login_time | 
dateitme | 
客户端进程登陆到服务器的时间 | 
| last_batch | 
dateitme | 
客户端进程上次执行存储过程或EXECUTE语句的时间 | 
| ecid | 
smallint | 
用于唯一标示单个进程进行操作的子线程的执行上下文ID | 
| open_tran | 
smallint | 
进程的打开事务数 | 
| Status | 
nchar(30) | 
进程的ID状态 | 
 | 
 | 
dormant:SQL Server 正在重置会话 | 
 | 
 | 
backgroud:会话正在运行一个后台任务,例如死锁检测 | 
 | 
 | 
running:会话正在运行或多个批处理(batch) | 
 | 
 | 
rollback:会话具有正在处理的事务回滚 | 
 | 
 | 
pending:会话正在等待工作线程变的可用(become available) | 
 | 
 | 
runnable:The task in the session is in the runnable queue of a scheduler while waiting to get a time quantum. | 
 | 
 | 
spinloop:会话中的任务正在等待调节锁变为可用 | 
 | 
 | 
suspend:会话正在等待事件,如 I/O 完成 | 
| spid | 
binary(86) | 
用户的全局唯一标识符(GUID) | 
| hostname | 
nchar(128) | 
工作站的名称 | 
| program_name | 
ncahr(128) | 
应用程序的名称 | 
| hostprocess | 
nchar(10) | 
工作站进程的ID号 | 
| cmd | 
nchar(16) | 
当前正在执行的命令 | 
| nt_domain | 
nchar(128) | 
客户端的 Windows 域(如果使用 Windows 身份验证)或可信连接的 Windows 域。 | 
| nt_username | 
nchar(128) | 
进程的windows用户名,或可信连接的widows用户名 | 
| net_library | 
nchar(12) | 
用于存储客户端网络库的列。 每个客户端进程都在网络连接上进入。 网络连接有一个与这些进程关联的网络库,该网络库使得这些进程可以建立连接。 | 
| loginname | 
nchar(128) | 
登录名 | 
| context_info | 
binary(128) | 
Data stored in a batch by using the SET CONTEXT_INFO statement. | 
| sql_handle | 
binary(20) | 
表示正在执行的批或对象 | 
| stmt_start | 
int | 
Starting offset of the current SQL statement for the specified sql_handle. | 
| stmt_end | 
int | 
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. | 
| request_id | 
int | 
请求ID | 
| page_resource | 
binary(8) | 
Applies to: SQL Server 2019 。An 8-byte hexadecimal representation of the page resource if the waitresource column contains a page. |