Delete One or More Jobs
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 for details.
This topic describes how to delete Microsoft SQL Server Agent jobs in SQL Server by using SQL Server Management Studio, Transact-SQL, or SQL Server Management Objects.
Before You Begin
Security
Unless you are a member of the sysadmin fixed server role, you can only delete jobs that you own.
Using SQL Server Management Studio
To delete a job
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 delete, and then click Delete.
In the Delete Object dialog box, confirm that the job you intend to delete is selected.
Click OK.
To delete multiple jobs
In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
Expand SQL Server Agent.
Right-click Job Activity Monitor, and click View Job Activity.
In the Job Activity Monitor, select the jobs you want to delete, right-click your selection, and choose Delete jobs.
Using Transact-SQL
To delete a job
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
USE msdb ; GO EXEC sp_delete_job @job_name = N'NightlyBackups' ; GO
For more information, see sp_delete_job (Transact-SQL).
Using SQL Server Management Objects
To delete multiple jobs
Use the JobCollection 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).