[ACCEPTED]-Looking for T-SQL scripts to delete a SQL Job-sql-server-agent
Accepted answer
USE msdb;
GO
EXEC sp_delete_job
@job_name = N'NightlyBackups' ;
GO
0
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].
.
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.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.