can't drop sql job

I ma unable to delete an SQL maintenance job (SQL 2005). Error is 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. (.Net SqlClient Data Provider)
ITeedOffAsked:
Who is Participating?
 
k_murli_krishnaConnect With a Mentor Commented:
use msdb
go
 
select * from sysmaintplan_subplans
 
delete from sysmaintplan_subplans
where subplan_name = 'Subplan_1' -- 'Subplan_1' let us say is the name of the subplan which is the culprit here.

For other solutions, refer:

Cannot Delete Job
http://www.sqlservercentral.com/Forums/Topic341284-149-1.aspx#bm341298
Can't delete a Maintenance Plan scheduled job
https://connect.microsoft.com/SQLServer/feedback/details/255226/cant-delete-a-maintenance-plan-scheduled-job
http://dbaspot.com/forums/ms-sqlserver/148756-cannot-delete-maintenance-plan.html
http://www.developmentnow.com/g/118_2006_10_0_0_831628/Cannot-Delete-Maintenance-Plans--SQL-2005.htm
1
 
Alfred A.Commented:
Hi,

My suggestion is for you to drop the constraint "FK_subplan_job_id" first before you delete the job.
0
 
ITeedOffAuthor Commented:
I do not understand the use msdb. Where do I access this?
0
All Courses

From novice to tech pro — start learning today.