Partager via


TargetServers Collection

Cette fonctionnalité sera supprimée dans une prochaine version de Microsoft SQL Server. Évitez d'utiliser cette fonctionnalité dans de nouveaux travaux de développement et prévoyez de modifier les applications qui utilisent actuellement cette fonctionnalité.

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

Modèle objet SQL-DMO qui affiche l'objet en cours

Properties

Notes

A SQL Server Agent job has an execution target. With Microsoft SQL Server 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, server. Each master server in an organization can have a unique list of target 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 target servers, specified by using the names of the target servers and/or the names of target server groups.

For any master server, target servers enlist or defect in the list of targets available for the master server. When a target enlists at an master, a TargetServer object referencing the target server is added to the TargetServers collection of the JobServer object referencing the master server. When a target server defects, the TargetServer object referencing the target 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)