The ApplyToTargetServerGroup method adds one or more execution targets to the list of targets maintained for the referenced SQL Server Agent job.
object.ApplyToTargetServerGroup( str )
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list |
str | String specifying a single TSX server group by name |
Before a SQL Server Agent job can execute, the job must have at least one step and an execution target. When a SQL Server Agent acts as a master (MSX) server for multiserver administration servers, known execution targets (TSX servers) can be grouped for easier targeting of multiple servers at one time.
When using SQL-DMO to create, schedule, and run SQL Server Agent jobs, use either the ApplyToTargetServer or ApplyToTargetServerGroup method to add an execution target. Use the ApplyToTargetServer method when a single SQL Server installation will be specified as an execution target. Use the ApplyToTargetServerGroup method when targeting grouped TSX servers.
For more information about configuring TSX server groups by using SQL-DMO, see TargetServerGroup Object.
HRESULT ApplyToTargetServerGroup(
SQLDMO_LPCSTR NewValue);