Showing posts with label newformat. Show all posts
Showing posts with label newformat. Show all posts

Sunday, March 11, 2012

Can't delete old maintenance plan job

In SQL 2005, I've migrated my old SQL 2000 maintenance plans to the new
format and I'm trying to delete a couple of migrated plans that I've redone.
I've managed to delete the plans, but the jobs for those plans are still
left. When I try to delete a job, I get the following error:
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. (Microsoft SQL Server, Error: 547)
I know what the error means, of course, but I'm not sure about the best way
to solve it. Thanks!Solved it myself -- I had to manually go into the system tables and delete
some orphaned references between the maintenance plans and jobs.
"Gary" wrote:

> In SQL 2005, I've migrated my old SQL 2000 maintenance plans to the new
> format and I'm trying to delete a couple of migrated plans that I've redon
e.
> I've managed to delete the plans, but the jobs for those plans are still
> left. When I try to delete a job, I get the following error:
> 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. (Microsoft SQL Server, Error: 547)
> I know what the error means, of course, but I'm not sure about the best wa
y
> to solve it. Thanks!