---
title: "Add Steps to a SQL Server Agent Master Job"
ms.custom: seo-lt-2019
ms.date: "01/19/2017"
ms.prod: sql
ms.prod_service: "sql-tools"
ms.reviewer: ""
ms.technology: ssms
ms.topic: conceptual
ms.assetid: 9cc1e8ab-7ddc-427b-859e-203aa7e24642
author: "markingmyname"
ms.author: "maghan"
---
# Add Steps to a SQL Server Agent Master Job
[!INCLUDE[appliesto-ss-asdb-asdw-pdw-md](../../includes/appliesto-ss-asdb-asdw-pdw-md.md)]
This topic describes how to add steps to a SQL Server Agent master job in [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] by using [!INCLUDE[ssManStudioFull](../../includes/ssmanstudiofull-md.md)] or [!INCLUDE[tsql](../../includes/tsql-md.md)].
**In This Topic**
- **Before you begin:**
[Limitations and Restrictions](#Restrictions)
[Security](#Security)
- **To add steps to a SQL Server Agent master job, using:**
[SQL Server Management Studio](#SSMSProcedure)
[Transact-SQL](#TsqlProcedure)
## Before You Begin
### Limitations and Restrictions
A [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Agent master job cannot be targeted at both local and remote servers.
### Security
#### Permissions
Unless you are a member of the **sysadmin** fixed server role, you can only modify jobs that you own. For detailed information, see [Implement SQL Server Agent Security](../../ssms/agent/implement-sql-server-agent-security.md).
## Using SQL Server Management Studio
#### To add steps to a SQL Server Agent master job
1. In **Object Explorer,** click the plus sign to expand the server that contains the job to which you want to add steps.
2. Click the plus sign to expand **SQL Server Agent**.
3. Click the plus sign to expand the **Jobs** folder.
4. Right-click the job to which you want to add steps and select **Properties**.
5. In the **Job Properties -**_job_name_ dialog box, under **Select a page**, select **Steps**. For more information on the available options on this page, see [Job Properties - New Job (Steps Page)](../../ssms/agent/job-properties-new-job-steps-page.md).
6. When finished, click **OK**.
## Using Transact-SQL
#### To add steps to a SQL Server Agent master job
1. In **Object Explorer**, connect to an instance of [!INCLUDE[ssDE](../../includes/ssde_md.md)].
2. On the Standard bar, click **New Query**.
3. Copy and paste the following example into the query window and click **Execute**.
```
-- creates a job step that changes database access to read-only for the Sales database.
-- specifies 5 retry attempts, with each retry to occur after a 5 minute wait.
-- assumes that the Weekly Sales Data Backup job already exists
USE msdb;
GO
EXEC sp_add_jobstep
@job_name = N'Weekly Sales Data Backup',
@step_name = N'Set database to read only',
@subsystem = N'TSQL',
@command = N'ALTER DATABASE SALES SET READ_ONLY',
@retry_attempts = 5,
@retry_interval = 5 ;
GO
```
For more information, see [sp_add_jobstep (Transact-SQL)](https://msdn.microsoft.com/97900032-523d-49d6-9865-2734fba1c755).