UFN_MKTSEGMENTLIST_ISFIELDENCRYPTED

Returns true if the specified field of a queryview catalog is encrypted.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@RECORDSOURCEID uniqueidentifier IN
@FIELDNAME nvarchar(255) IN

Definition

Copy


create function dbo.[UFN_MKTSEGMENTLIST_ISFIELDENCRYPTED]
(
  @RECORDSOURCEID uniqueidentifier,
  @FIELDNAME nvarchar(255)
)
returns bit
as begin
  if @RECORDSOURCEID is null
    return 0;

  declare @ISENCRYPTED nvarchar(5);
  declare @OUTPUTDEFINITIONXML xml;

  select
    @OUTPUTDEFINITIONXML = [Q].[OUTPUTDEFINITIONXML]
  from
    dbo.[QUERYVIEWCATALOG] [Q]
  where
    [Q].[ID] = @RECORDSOURCEID;

  select
    @ISENCRYPTED = T.c.value('(@IsEncryptedField)[1]','nvarchar(5)'
  from
    @OUTPUTDEFINITIONXML.nodes('declare namespace QV="bb_appfx_queryview";/QueryViewOutput/QV:OutputFields/QV:OutputField') T(c)
  where
    T.c.value('(@Name)[1]','nvarchar(255)') = @FIELDNAME;

  return (case when @ISENCRYPTED in ('1', 'true') then 1 else 0 end);
end