How to create a job (Transact-SQL)

To create a 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.

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.

Because local jobs are cached by the local SQL Server Agent, any modifications implicitly force SQL Server Agent to recache the job. Because SQL Server Agent does not cache the job until sp_add_jobserver is called, it is more efficient to call sp_add_jobserver last.


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

  


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