The EnumProcesses method returns a QueryResults object enumerating the Microsoft® SQL Server™ processes running on the referenced SQL Server installation.
object.EnumProcesses( [ WhoByNameOrID ] ) as QueryResults
| Part | Description |
|---|---|
| object | Expression that evaluates to an object in the Applies To list |
| WhoByNameOrID | String or small integer identifying a login name or process ID |
A QueryResults object containing one result set defined by these columns.
| Column | Data type | Description |
|---|---|---|
| spid | smallint | SQL Server process ID. |
| status | nchar(31) | Execution state, such as running or sleeping. |
| loginname | nvarchar(129) | Name of the SQL Server login. |
| hostname | nchar(129) | If applicable, network name of the client workstation. |
| program_name | nchar(129) | If applicable, name of the client application. |
| cmd | nchar(34) | Abbreviated indicator of current command. AWAITING COMMAND when no command is current. |
| dbname | nvarchar(129) | Database currently in use by process |
| cpu | integer | Cumulative CPU time for process. |
| memusage | integer | 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. |
| blocked | smallint | When nonnull, process ID blocking a request of the process ID listed by the row. |
HRESULT EnumProcesses(
LPSQLDMOQUERYRESULTS* ppResults,
SQLDMO_LPCSTR szWho = NULL,
long lWho = -1);