all groups > sql server new users > october 2006 >
You're in the

sql server new users

group:

Can't delete backup job!!!


Can't delete backup job!!! RandyH
10/18/2006 9:08:25 AM
sql server new users: For the life of me, I can't delete a backup job that was created with the
maintenance wizard.

The job deletes from the Management\Maintenance tree, but doesn't delete
from the SQL Server Agent tree.

I script the job to drop and get this error msg:

Msg 547, Level 16, State 0, Procedure sp_delete_job, Line 170
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.

I don't know what this means:
The DELETE statement conflicted with the REFERENCE constraint
"FK_subplan_job_id".

In dbo.sysmaintplan_subplans I can see what the error is referring too, but
it doesn't really lead me to anything else.

And

Why when you create a maintenance plan using the create maintenance plan
wizard, does the SQL Agent add a "subplan" to the job?

I hope someone can help me.
Thank you,
RandyH

Re: Can't delete backup job!!! RandyH
10/19/2006 9:08:13 AM
OK...from the msdn forums others were having the same problem.


Because there was a foreign key constraint on the sysmaintplan_log. I
deleted the item with the constraint in the sysmaintplan_log table.

delete from dbo.sysmaintplan_log where plan_id = 'my_plan_id '

Then ran:
EXECUTE sp_delete_maintenance_plan 'my_plan_id '

and that did the trick.

Thank you!



[quoted text, click to view]
AddThis Social Bookmark Button