sp_sjobmodify

Description

Allows you to modify any of the fields in a scheduled job, a job, or a schedule.

Syntax

sp_sjobmodify @name=’...’, @option=’...’

Parameters

name

The name or ID of the scheduled job, job, or schedule that is to be modified.

option

A comma-separated list of the field names to modify and the new values:

Returns

Returns 0 on success or an error code.

Examples

Example 1

The following example modifies the scheduled job “svr1_clean_stats,” updating the schedule to repeat every two hours between 10:00 and 16:00. The days or dates on which the scheduled job operates are unchanged.

sp_sjobmodify @name=’svr1_clean_stats’,�
@option=’repeats=2hours,starttime=10:00,endtime=16:00’�

Example 2

The following example modifies the job “backup_db5,” updating the default timeout to 120 minutes:

sp_sjobmodify @name=’jname=backup_db5’, @option=’default_timeout=120’

Example 3

The following example modifies the job named “orders_picked_report,” removing the shared property and changing the owner to mary. The caller requires js_admin_role to change the job owner.

sp_sjobmodify @name=’jname=orders_picked_report’, �
@option=’jproperties=shared:false,owner=mary’

Usage

By default, the @name argument is the name or ID of a scheduled job. To specify the name or ID of a job or a schedule, the @name argument is prefixed with jname or sname.

Following is an example of using @jname:

@name= ‘jname=run_update_stats’

Following is an example of using @sname:

@name= ‘sname=daily_schedule’