EnumProcesses Method

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.

The EnumProcesses method returns a QueryResults object that enumerates the Microsoft SQL Server processes running on a referenced instance of Microsoft SQL Server.

Syntax

object
.EnumProcesses( [ WhoByNameOrID ] )as QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • WhoByNameOrID
    String or small integer that identifies a login name or process ID.

Prototype (C/C++)

HRESULT EnumProcesses(
LPSQLDMOQUERYRESULTS* ppResults,
SQLDMO_LPCSTR szWho = NULL,
long lWho = -1);

Returns

A QueryResults object that contains one result set defined by these columns.

Column Data type Description

blocked

smallint

When nonnull, process ID blocking a request of the process ID listed by the row.

cmd

nchar(34)

Abbreviated indicator of current command. AWAITING COMMAND when no command is current.

cpu

integer

Cumulative CPU time for process.

dbname

nvarchar(129)

Database currently in use by process.

hostname

nchar(129)

If applicable, network name of the client workstation.

loginname

nvarchar(129)

Name of the SQL Server login.

memusage

integer

Number of pages in the procedure cache currently allocated to this process. A negative number indicates that the process is freeing memory allocated by another process.

program_name

nchar(129)

If applicable, name of the client application.

spid

smallint

SQL Server process ID.

status

nchar(31)

Execution state, such as running or sleeping.

ecid

smallint

Execution context ID used to uniquely identify the subthreads operating on behalf of a single process. If the computer is running an instance of SQL Server 7.0 or earlier, a value of zero is returned.

Remarks

If an application calls EnumProcesses on an instance of SQL Server version 7.0, the ecid column returns zero.

Applies To:

SQLServer Object