[ACCEPTED]-Looking for T-SQL scripts to delete a SQL Job-sql-server-agent

Accepted answer
Score: 16
USE msdb;


EXEC sp_delete_job
    @job_name = N'NightlyBackups' ;



Score: 3

You're looking for sp_delete_job:

[srv].[master].[dbo].sp_delete_job @job_name = 'MyJob'

So this four part name 4 only works with linked servers. Otherwise, you'll 3 have to connect to the server, and run that 2 command against it (with everything right 1 of [dbo]..

Score: 2

It's worth noting that you can just use 4 SSMS, choose the job, right-click and pick 3 "Delete", and then use the Script button 2 at the top of the dialog box to generate 1 a script like the ones suggested here.

More Related questions