您的位置:首页 > 大数据 > 人工智能

无法删除Maintainplan Job 错误547

2012-08-21 17:19 260 查看
今天删除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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐