 
     delete from task
     from task t inner join deleted d on t.taskId = d.taskId
-END
+END')
 
 GO
+

    DROP TRIGGER trigger_task_delete;
GO

CREATE TRIGGER trigger_task_delete
ON task
INSTEAD OF DELETE
AS

  service_name VARCHAR(255) NOT NULL,
  upgrade_state VARCHAR(32) NOT NULL DEFAULT 'NONE',
  security_state VARCHAR(32) NOT NULL DEFAULT 'UNSECURED',
  PRIMARY KEY CLUSTERED (id)
);

CREATE NONCLUSTERED INDEX idx_host_component_state on hostcomponentstate(host_id, component_name, service_name, cluster_id);
