UFN_MKTREVENUELETTER_MAKETABLENAME

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

Return

Return Type
nvarchar(53)

Parameters

Parameter Parameter Type Mode Description
@MKTRECORDSOURCEID uniqueidentifier IN

Definition

Copy


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

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

  return @TABLENAME;
end