Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 how do I delete a job

Author  Topic 

groadssql
Starting Member

9 Posts

Posted - 2010-12-14 : 15:48:46
How do you delete a job. I created a backup plan with 3 steps. I want to delete that plan. It is simple to find the steps on the internet on how to do that but none of them work. Using SSMS and steps I found on the internet failed so I tried T-SQL statement below.

This is my command:
exec msdb.dbo.sp_delete_job @job_name = 'backupPlan1.Subplan_1'

This is the error I get:

Msg 547, Level 16, State 0, Procedure sp_delete_job, Line 182
The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id". The conflict occurred in database "msdb", table "dbo.sysmaintplan_subplans", column 'job_id'.
The statement has been terminated.

GAR

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-12-14 : 18:12:54
If it's a maintenance plan you probably have to use the wizard to delete it properly.
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2010-12-23 : 08:42:11
just delete the maintenance plan and the job gets automatically deleted.
Go to Top of Page
   

- Advertisement -