TargetServers Collection

SQL-DMO

SQL-DMO

TargetServers Collection

The TargetServers collection contains TargetServer objects that reference multiserver administration TSX servers.

Properties
Count Property  
Methods
Item Method Refresh Method
ItemByID Method Remove Method (Collections)

Remarks

A SQL Server Agent job has an execution target. With Microsoft® SQL Server™ version 7.0, the SQL Server Agent of one server can direct job execution on other instances of SQL Server within an organization. A server directing job execution is a master (MSX), server. Each MSX server in an organization can have a unique list of target (TSX) servers.

A SQL Server Agent job execution target can be:

  • The instance of SQL Server on which a SQL Server Agent executes.

  • One or more TSX servers, specified by using the names of the TSX servers and/or the names of target server groups.

For any MSX server, TSX servers enlist or defect in the list of targets available for the MSX server. When a TSX enlists at an MSX, a TargetServer object referencing the TSX is added to the TargetServers collection of the JobServer object referencing the MSX server. When a TSX server defects, the TargetServer object referencing the TSX server will be removed from the TargetServers collection when the collection is refreshed. For more information, see MSXEnlist Method and MSXDefect Method.

When using the Item method, the TargetServers collection supports member identification using either name or ordinal reference syntax. For example:

Set oTargetServer = oJobServer.TargetServers("LONDON1")

Or:

Set oTargetServer = oJobServer.TargetServers(1)