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

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand SQL Server Agent, expand Jobs, right-click the job you want to delete, and then click Delete.

  3. In the Delete Object dialog box, confirm that the job you intend to delete is selected.

  4. Click OK.

To delete multiple jobs

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand SQL Server Agent.

  3. Right-click Job Activity Monitor, and click View Job Activity.

  4. 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

  1. In Object Explorer, connect to an instance of Database Engine.

  2. On the Standard bar, click New Query.

  3. 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).