共用方式為


EnumMergeAgentSessions Method

未來的 Microsoft SQL Server 發行版本將不再提供此功能。請避免在新的開發工作中使用此功能,並計劃修改目前使用此功能的應用程式。

The EnumMergeAgentSessions method returns a QueryResults object that enumerates execution status data for the merge replication agent specified.

語法

object
.EnumMergeAgentSessions(
AgentName
,
SessionType
, 
SessionDuration
)
as 
QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • AgentName
    String that identifies a merge replication 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 launched within the number of hours specified. Use 0 to specify no restriction on agent session start time.

Prototype (C/C++)

HRESULT EnumMergeAgentSessions(
SQLDMO_LPCSTR AgentName,
SQLDMO_SESSION_TYPE SessionType,
long SessionDuration,
LPSQLDMOQUERYRESULTS* ppResults);

Settings

Set SessionType using these values.

Constant Value Description

SQLDMOSession_All

1

Output contains log information for all sessions for agent.

SQLDMOSession_Errors

2

Output contains log information only for those execution attempts ending in error.

Returns

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

Column Data type Description

average_rows

integer

Average number of rows per second.

action_count

integer

Number of session history records.

comments

nvarchar(256)

Descriptive text.

duration

integer

Elapsed time of the session.

error_id

integer

When nonzero, Microsoft SQL Server error message number.

publisher_conflicts

integer

Number of conflicts at the Publisher.

publisher_deletecount

integer

Number of deletes at the Publisher.

publisher_insertcount

integer

Number of inserts at the Publisher.

publisher_updatecount

integer

Number of updates at the Publisher.

runstatus

integer

Executing state. Interpret using SQLDMO_TASKSTATUS_TYPE.

start_time

nvarchar(26)

Date and time of last scheduled execution.

subscriber_conflicts

integer

Number of conflicts at the Subscriber.

subscriber_/deletecount

integer

Number of deletes at the Subscriber.

subscriber_/insertcount

integer

Number of inserts at the Subscriber.

subscriber_/updatecount

integer

Number of updates at the Subscriber.

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 20040512 18:12:00.000 is interpreted as 6:12 P.M., May 12, 2004.

Applies To:

DistributionPublisher Object