EnumTargetServers Method (SQL-DMO)

The EnumTargetServers method returns a QueryResults object enumerating the execution targets of the referenced SQL Server Agent job.

Applies To

Job Object

Syntax

object.EnumTargetServers() as QueryResults

Part Description
object Expression that evaluates to an object in the Applies To list

Returns

A QueryResults object containing one result set defined by these columns.

Column Data type Description
server_id integer System-generated identifier of a target server
server_name nvarchar(31) Network name of the server running Microsoft® SQL Server™
enlist_date smalldatetime When applicable, date and time at which the TSX server enlisted in the multiserver administration group
last_poll_date smalldatetime When applicable, most recent date and time at which the TSX server polled the MSX for new instructions
last_run_date integer When nonzero, date on which execution occurred formatted as described in Remarks
last_run_time integer When nonzero, time at which execution occurred formatted as described in Remarks
last_run_duration integer When nonzero, execution duration expressed as a number of seconds
last_run_outcome tinyint Execution outcome interpreted by using SQLDMO_JOBOUTCOME_
TYPE
last_outcome_
message
nvarchar(1025) SQL Server message raised in response to last execution

Remarks

The result set column last_run_date represents the execution date as a scaled long integer. The integer is built as a sum of the year scaled by 10000, the month scaled by 100, and the day. For example, the date April 19, 1997 is represented by the long integer value 19970419.

The result set column last_run_time represents execution time as a scaled long integer. The integer is built as a sum of the hour scaled by 10000, the minute scaled by 100, and the seconds. The value uses a 24-hour clock. For example, the time 1:03:09 P.M. is represented by the long integer value 130309.

Prototype (C/C++)

HRESULT EnumTargetServers(
LPSQLDMOQUERYRESULTS* ppResults);

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.