UFN_MKTSEGMENTLIST_BASECURRENCYIDMATCHESLISTBASECURRENCYID

Ensures that the base currency on a list segment matches that of its source list.

Return

Return Type
bit

Parameters

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

Definition

Copy


CREATE function dbo.[UFN_MKTSEGMENTLIST_BASECURRENCYIDMATCHESLISTBASECURRENCYID]
(
  @BASECURRENCYID uniqueidentifier,
  @LISTID uniqueidentifier
)
returns bit
as 
  begin
    declare @MATCH bit;
    declare @LISTBASECURRENCYID uniqueidentifier;

    set @MATCH = 1;

    if not @LISTID is null
      begin
        select @LISTBASECURRENCYID = [MKTLIST].[BASECURRENCYID] 
          from dbo.[MKTLIST] 
          where [MKTLIST].[ID] = @LISTID;

        if @BASECURRENCYID is not null
          set @MATCH = (select case when @BASECURRENCYID = @LISTBASECURRENCYID then 1 else 0 end);
      end;

    return @MATCH;
  end;