码迷,mamicode.com
首页 > 数据库 > 详细

SQL SERVER 2005删除维护作业报错:The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_jo

时间:2015-04-08 13:21:44      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

下面是网上找的一些资料来解决这个问题:
先获取这个job_id:
技术分享

USE [msdb]
GO
/****** Object:  Job [dbbackup_diff.Subplan_1]    Script Date: 04/08/2015 10:22:46 ******/
EXEC msdb.dbo.sp_delete_job @job_id=N‘588acfb8-630b-41c3-aa47-90d3671bda90‘, @delete_unused_schedule=1
GO

根据job_id到subplan_id:

select subplan_id FROM msdb.dbo.sysmaintplan_subplans where job_id=‘588acfb8-630b-41c3-aa47-90d3671bda90‘
subplan_id
FE56B397-4704-4AA7-BE49-767C1574E7D0

从系统表msdb.dbo.sysmaintplan_log和msdb.dbo.sysmaintplan_subplans中分别删除subplan_id为‘FE56B397-4704-4AA7-BE49-767C1574E7D0’的记录:

delete from msdb.dbo.sysmaintplan_log where subplan_id=‘FE56B397-4704-4AA7-BE49-767C1574E7D0‘
delete FROM msdb.dbo.sysmaintplan_subplans WHERE SUBPLAN_ID=‘FE56B397-4704-4AA7-BE49-767C1574E7D0‘

再次回到图形界面再删除job就不会报错了。

参考:
http://www.cnblogs.com/kerrycode/p/3852231.html

SQL SERVER 2005删除维护作业报错:The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_jo

标签:

原文地址:http://blog.csdn.net/chinadm123/article/details/44937741

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!