Applies To: SQL Server 2014, SQL Server 2016 Preview
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Applies a job to one or more target servers or to the target servers belonging to one or more target server groups.
The job identification number of the job to apply to the specified target servers or target server groups. job_id is uniqueidentifier, with a default of NULL.
[ @job_name =] 'job_name'
The name of the job to apply to the specified the associated target servers or target server groups. job_name is sysname, with a default of NULL.
Either job_id or job_name must be specified, but both cannot be specified.
[ @target_server_groups =] 'target_server_groups'
A comma-separated list of target server groups to which the specified job is to be applied. target_server_groups is nvarchar(2048), with a default of NULL.
[ @target_servers= ] 'target_servers'
A comma-separated list of target servers to which the specified job is to be applied. target_serversis nvarchar(2048), with a default of NULL.
[ @operation= ] 'operation'
Is whether the specified job should be applied to or removed from the specified target servers or target server groups. operationis varchar(7), with a default of APPLY. Valid operations are APPLY and REMOVE.
sp_apply_job_to_targets provides an easy way to apply (or remove) a job from multiple target servers, and is an alternative to calling sp_add_jobserver (or sp_delete_jobserver) once for each target server required.