The EnumDistributionAgentSessions method returns a QueryResults object that enumerates execution status information for a specified Distribution Agent.
object.EnumDistributionAgentSessions( AgentName,
SessionType, SessionDuration ) as QueryResults
object
Expression that evaluates to an object in the Applies To list.
AgentName
String that identifies a Distribution Agent by name.
SessionType
Long integer that indicates session type as described in Settings.
SessionDuration
Long integer that specifies a number of hours. Restricts result set membership to those sessions started within the number of hours specified. Use 0 to specify no restriction on agent session start time.
HRESULT EnumDistributionAgentSessions(
SQLDMO_LPCSTR AgentName,
SQLDMO_SESSION_TYPE SessionType,
long SessionDuration,
LPSQLDMOQUERYRESULTS* ppResults);
Set SessionType using these values.
| Constant | Value | Description |
|---|---|---|
| SQLDMOSession_All | 1 | Output contains log information for all agent sessions. |
| SQLDMOSession_Errors | 2 | Output contains log information only for those execution attempts ending in error. |
A QueryResults object that contains one result set defined by these columns.
| Column | Data type | Description |
|---|---|---|
| integer | Reserved. Returns 0 always. | |
| action_count | integer | Number of session history records. |
| average_commands | integer | Average number of commands per transaction delivered in the session. |
| comments | nvarchar(256) | Descriptive text. |
| delivered_commands | integer | Cumulative number of commands delivered in the session. |
| delivered_transactions | integer | Cumulative number of transactions delivered in the session. |
| delivery_latency | integer | Latency, in milliseconds, between the transaction entering the distribution database and applied to the Subscriber. |
| delivery_rate | float | Average number of commands delivered per second. |
| duration | integer | Elapsed time of the session in seconds. |
| error_id | integer | When nonzero, Microsoft® SQL Server™ 2000 error message number. |
| runstatus | integer | Executing state. Interpret using SQLDMO_TASKSTATUS_TYPE. |
| start_time | nvarchar(26) | Date and time of last scheduled execution. |
| time | nvarchar(26) | Date and time of message logging. |
In the result set, date and time data returned in start_time and time is formatted as YYYYMMDD hh:mm:ss.fff.
| Date part | Description |
|---|---|
| YYYY | Represents the year in four digits. |
| MM | Represents the month in two digits (zero padded). |
| DD | Represents the day of the month in two digits (zero padded). |
| hh | Represents the hour using two digits, a twenty-four hour clock (zero padded). |
| mm | Represents the minute in two digits (zero padded). |
| ss | Represents the second in two digits (zero padded). |
| fff | Represents the fractional part of the second in three digits. |
For example, the value 19990911 18:12:00.000 is interpreted as 6:12 P.M., September 11, 1999.