UFN_MKTSEGMENT_BASECURRENCYIDMATCHESPARENTBASECURRENCYID
Ensures that the base currency on a segment matches that of its parent.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@BASECURRENCYID | uniqueidentifier | IN | |
@SEGMENTLISTID | uniqueidentifier | IN | |
@SEGMENTTYPECODE | tinyint | IN |
Definition
Copy
CREATE function dbo.[UFN_MKTSEGMENT_BASECURRENCYIDMATCHESPARENTBASECURRENCYID]
(
@BASECURRENCYID uniqueidentifier,
@SEGMENTLISTID uniqueidentifier,
@SEGMENTTYPECODE tinyint
)
returns bit
as
begin
declare @MATCH bit;
declare @PARENTBASECURRENCYID uniqueidentifier;
set @MATCH = 1;
if not @SEGMENTLISTID is null
begin
if @SEGMENTTYPECODE = 2
begin
select @PARENTBASECURRENCYID = [MKTLIST].[BASECURRENCYID]
from dbo.[MKTLIST]
inner join dbo.[MKTSEGMENTLIST] on [MKTLIST].[ID] = [MKTSEGMENTLIST].[LISTID]
where [MKTSEGMENTLIST].[ID] = @SEGMENTLISTID;
if @BASECURRENCYID is not null
set @MATCH = (select case when @BASECURRENCYID = @PARENTBASECURRENCYID then 1 else 0 end);
end;
end;
return @MATCH;
end;