2014年3月31日 星期一

SQL維護計畫手動刪除錯誤

--找出 維護計畫的ID
use msdb;
DECLARE @ID VarChar(max)
SET @ID=(select id from sysmaintplan_plans WHERE name='MaintenancePlan');

--刪除維護計畫相關Table
delete from sysmaintplan_log where plan_id = @ID
delete from sysmaintplan_subplans where plan_id = @ID
delete from sysmaintplan_plans where id = @ID

沒有留言: