sp_delete_jobstep

Transact-SQL Reference

Transact-SQL Reference

sp_delete_jobstep

Removes a job step from a job.

Syntax

sp_delete_jobstep [ @job_id = ] job_id , | [ @job_name = ] 'job_name' ,
    [ @step_id = ] step_id

Arguments

[@job_id =] job_id

Is the identification number of the job from which the step will be removed. job_id is uniqueidentifier, with a default of NULL.

[@job_name =] 'job_name'

Is the name of the job from which the step will be removed. job_name is sysname, with a default of NULL.

Note  Either job_id or job_name must be specified; both cannot be specified.

[@step_id =] step_id

Is the identification number of the step being removed. step_id is int, with no default.

Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Remarks

Removing a job step automatically updates the other job steps that reference the deleted step.

For more information about the steps associated with a particular job, run sp_help_jobstep.

Microsoft SQL Server Enterprise Manager provides an easy, graphical way to manage jobs, and is the recommended way to create and manage the job infrastructure.

Permissions

Execute permissions default to the public role.

Examples

This example removes job step 1 from the job Nightly Backups.

USE msdb
EXEC sp_delete_jobstep @job_name = 'Nightly Backups', 
   @step_id = 1

See Also

Modifying and Viewing Jobs

sp_add_jobstep

sp_update_jobstep

sp_help_jobstep

System Stored Procedures