UFN_MKTMARKETINGPLANITEM_BASECURRENCIESMATCH

Indicates whether or not the base currency of a marketing plan item matches that of its parent plan.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@BASECURRENCYID uniqueidentifier IN
@MARKETINGPLANID uniqueidentifier IN

Definition

Copy


create function dbo.[UFN_MKTMARKETINGPLANITEM_BASECURRENCIESMATCH]
(
  @BASECURRENCYID uniqueidentifier,
  @MARKETINGPLANID uniqueidentifier
)
returns bit
as 
  begin
    declare @MATCH bit;

    set @MATCH = 1;

    if not @BASECURRENCYID is null
      set @MATCH = case when @BASECURRENCYID = (select [BASECURRENCYID] from dbo.[MKTMARKETINGPLAN] where [ID] = @MARKETINGPLANID) then 1 else 0 end;

    -- if @BASECURRENCYID is null, the trigger on the plan item table is going to set it to match that of the plan, so the point is moot


    return @MATCH;
  end;