UFN_MKTREVENUERECEIPT_MAKETABLENAME

Returns the name of the revenue receipt table for a given record source.

Return

Return Type
nvarchar(54)

Parameters

Parameter Parameter Type Mode Description
@MKTRECORDSOURCEID uniqueidentifier IN

Definition

Copy


CREATE function dbo.[UFN_MKTREVENUERECEIPT_MAKETABLENAME]
(
  @MKTRECORDSOURCEID uniqueidentifier
)
returns nvarchar(54)
as
begin
  declare @TABLENAME nvarchar(54);

  /* If this is BBEC, and the BBEC record source, then use the existing BBEC revenue receipt table. */
  if dbo.[UFN_MKTRECORDSOURCE_VALIDFORBBEC](@MKTRECORDSOURCEID) = 1
    set @TABLENAME = 'REVENUERECEIPT';
  else
    set @TABLENAME = 'MKTREVENUERECEIPT_' + replace(cast(@MKTRECORDSOURCEID as nvarchar(36)), '-', '_');

  return @TABLENAME;
end