加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

无法删除Maintainplan Job 错误547

发布时间:2020-12-12 14:30:39 所属栏目:MsSql教程 来源:网络整理
导读:今天删除 SQLServer 维护计划的时候出现下面的错误: ? The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id". The conflict occurred in database "msdb",table "dbo.sysmaintplan_subplans". (Microsft SQL Server,Error:5

今天删除SQLServer维护计划的时候出现下面的错误:

?

The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id". The conflict occurred in database "msdb",table "dbo.sysmaintplan_subplans". (Microsft SQL Server,Error:547)

?

?

解决办法:

?

Use MSDB

go

delete from sysmaintplan_subplanswherejob_idin

( select job_idfromsysjobswhere namelike'%MaintenancePlan.Subplan_1%')

?

执行成功后在Management studio中可以正常删除维护计划Job

?

如果上面的语句无法成功,提示“tablesysmaintplan_log,可以先执行下面的语句然后在删除sysmaintplan_subplans记录。

?

deletesysmaintplan_log

? fromsysmaintplan_subplans as subplans INNER JOIN

??? sysjobs_viewas syjobsonsubplans.job_id=syjobs.job_idINNERJOIN

??? sysmaintplan_log onsubplans.subplan_id=sysmaintplan_log.subplan_id

? where (syjobs.name= @jobName);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读