Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Azure SQL Managed Instance
Important
On Azure SQL Managed Instance, most, but not all SQL Server Agent features are currently supported. See Azure SQL Managed Instance T-SQL differences from SQL Server or SQL Agent job limitations in SQL Managed Instance for details.
This article describes how to change the properties of SQL Server Agent jobs in SQL Server by using SQL Server Management Studio, Transact-SQL, or SQL Server Management Objects.
Limitations
A SQL Server Agent master job can't be targeted at both local and remote servers.
Security
Unless you're 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.
Use SQL Server Management Studio
In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
Expand SQL Server Agent, expand Jobs, right-click the job you want to modify, and then select Properties.
In the Job Properties dialog box, update the job's properties, steps, schedule, alerts, and notifications using the corresponding pages.
Use Transact-SQL
In Object Explorer, connect to an instance of the Database Engine, and then expand that instance.
On the toolbar, select New Query.
In the query window, use the following system stored procedures to modify a job.
Execute sp_update_job (Transact-SQL) to change the attributes of a job.
Execute sp_update_schedule (Transact-SQL) to change the scheduling details for a job definition.
Execute sp_add_jobstep (Transact-SQL) to add new job steps.
Execute sp_update_jobstep (Transact-SQL) to change preexisting job steps.
Execute sp_delete_jobstep (Transact-SQL) to remove a job step from a job.
Extra stored procedures to modify any SQL Server Agent master job:
Execute sp_delete_jobserver (Transact-SQL) to delete a server currently associated with a job.
Execute sp_add_jobserver (Transact-SQL) to associate a server with the current job.
Use SQL Server Management Objects
Use the Job class by using a programming language that you choose, such as Visual Basic, Visual C#, or PowerShell. For more information, see SQL Server Management Objects (SMO).