UFN_CONSTITUENTSEGMENT_MAKETABLENAME

Returns the name of the constituent segment table for a given QueryViewCatalogID.

Return

Return Type
nvarchar(55)

Parameters

Parameter Parameter Type Mode Description
@QUERYVIEWCATALOGID uniqueidentifier IN

Definition

Copy


CREATE function dbo.[UFN_CONSTITUENTSEGMENT_MAKETABLENAME]
(
  @QUERYVIEWCATALOGID uniqueidentifier
)
returns nvarchar(55)
as
begin
  declare @TABLENAME nvarchar(55);

  /* If this is BBEC, and the BBEC record source, then use a special name without the guid on it */
  if dbo.[UFN_MKTRECORDSOURCE_VALIDFORBBEC](@QUERYVIEWCATALOGID) = 1
    set @TABLENAME = 'CONSTITUENTSEGMENT';
  else
    set @TABLENAME = 'CONSTITUENTSEGMENT_' + replace(cast(@QUERYVIEWCATALOGID as nvarchar(36)), '-', '_');

  return @TABLENAME;
end