USP_MKTMARKETINGPLAN_DELETE

Executes the "Marketing Plan: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


CREATE procedure dbo.[USP_MKTMARKETINGPLAN_DELETE]
(
  @ID uniqueidentifier,
  @CHANGEAGENTID uniqueidentifier
)
as
  set nocount on;

  -- Should not be able to delete plan if there is an effort created using the plan.

  if exists (select 1 from dbo.[MKTSEGMENTATION] where [MARKETINGPLANITEMID] in (select [ID] from dbo.[MKTMARKETINGPLANITEM] where [MARKETINGPLANID] = @ID))
    raiserror('BBERR_MARKETINGEFFORTEXISTS', 13, 1);

  exec dbo.[USP_MKTMARKETINGPLAN_DELETEBYID_WITHCHANGEAGENTID] @ID, @CHANGEAGENTID;

  return 0;