Command syntax

Job Scheduler provides a concise set of stored procedures for working with scheduled jobs. Their names are prefixed with sp_sjob, where sjob is an abbreviation for scheduled job.�

The stored procedures for creating jobs, schedules, and scheduled jobs will use the server user name to record the owner. The suser_name system function will be used to obtain this.The stored procedures also support working with the underlying job and schedule objects, and provide an interface to control scheduled jobs that are currently running and manage the history and job output that they produce.�

The stored procedures accept a name or ID argument, which specifies the object they should operate on. Stored procedures that operate on several different objects, such as a job, a schedule, or a scheduled job, accept a prefix to the name or ID argument, which specifies the sort of object the name or ID refers to: for schedules – @sname; for jobs – @jname.

The following is an example of @sname:

@name= ‘sname=daily_schedule’

The following is an example of using @jname:

@name= ‘jname=run_update_stats’

The name or ID default is to reference a scheduled job.�

General usage