How to create a master SQL Server Agent job (Transact-SQL)

To create a master SQL Server Agent job

  1. Execute sp_add_job to create a job.
  2. Execute sp_add_jobstep to create one or more job steps.
  3. Execute sp_add_jobschedule to create a job schedule.
  4. Execute sp_add_jobserver to specify the target servers on which the job is to run.

Note It is recommended that you execute sp_add_jobserver after sp_add_jobstep for maximum efficiency in communicating job changes to all involved servers.

Changes to master SQL Server Agent jobs must be propagated to all involved target servers. Because target servers do not initially download the job until sp_add_jobserver is called, it is recommended that all job steps and job schedules for a particular job be created before executing sp_add_jobserver. Otherwise, sp_post_msx_operation must be subsequently called to request that the target server(s) redownload the modified job.


See Also
Defining Multiserver Jobs System Stored Procedures (SQL Server Agent)

  


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