--- title: "sp_delete_jobstep (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "08/09/2016" ms.prod: sql ms.prod_service: "database-engine" ms.reviewer: "" ms.technology: system-objects ms.topic: "language-reference" f1_keywords: - "sp_delete_jobstep" - "sp_delete_jobstep_TSQL" dev_langs: - "TSQL" helpviewer_keywords: - "sp_delete_jobstep" ms.assetid: 421ede8e-ad57-474a-9fb9-92f70a3e77e3 author: "stevestein" ms.author: "sstein" --- # sp_delete_jobstep (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)] Removes a job step from a job. ![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ``` sp_delete_jobstep { [ @job_id = ] job_id | [ @job_name = ] 'job_name' } , [ @step_id = ] step_id ``` ## Arguments `[ @job_id = ] job_id` 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'` 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` 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**. > **NOTE:** Calling **sp_delete_jobstep** with a *step_id* value of zero deletes all job steps for the job. Microsoft SQL Server Management Studio provides an easy, graphical way to manage jobs, and is the recommended way to create and manage the job infrastructure. ## Permissions By default, members of the **sysadmin** fixed server role can execute this stored procedure. Other users must be granted one of the following [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Agent fixed database roles in the **msdb** database: - **SQLAgentUserRole** - **SQLAgentReaderRole** - **SQLAgentOperatorRole** For details about the permissions of these roles, see [SQL Server Agent Fixed Database Roles](../../ssms/agent/sql-server-agent-fixed-database-roles.md). Only members of **sysadmin** can delete a job step that is owned by another user. ## Examples The following example removes job step `1` from the job `Weekly Sales Data Backup`. ``` USE msdb ; GO EXEC dbo.sp_delete_jobstep @job_name = N'Weekly Sales Data Backup', @step_id = 1 ; GO ``` ## See Also [View or Modify Jobs](../../ssms/agent/view-or-modify-jobs.md) [sp_add_jobstep (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-add-jobstep-transact-sql.md) [sp_update_jobstep (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-update-jobstep-transact-sql.md) [sp_help_jobstep (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-help-jobstep-transact-sql.md) [System Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/system-stored-procedures-transact-sql.md)