sp_sjobcontrol

Description

Defines an interface for controlling running jobs.�

Syntax

sp_sjobcontrol @name=’...’, @option=’...’

Parameters

name

The name or ID of the scheduled job, a job, or a runid to be controlled. �

option

Specifies a comma-separated list of options and option_name=option_value pairs that define the action to perform.

Returns

Returns 0 for success or an error code.

Examples

Example 1

The following example requests the JS Task and JS Agent to terminate the running job with runid 1532:�

sp_sjobcontrol @name=’runid=1532’, @option=’terminate’

Example 2

The following example marks the scheduled job called “svr1_load_sales_data” so that it can be run now. The existing schedule is unchanged.

sp_sjobcontrol @name=’svr1_load_sales_data’, @option=’run_now’

Example 3

The following example disables all of the caller’s scheduled jobs that use the job called “check_user_logins”.

sp_sjobcontrol @name=’jname=check_user_logins’, @option=’disable’

Usage

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