UFN_DATALIST_ISUSERDEFINED

Determines whether a data list is user-defined based on its implementation type and spec XML.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@IMPLEMENTATIONTYPE tinyint IN
@SPECXML xml IN

Definition

Copy


create function dbo.UFN_DATALIST_ISUSERDEFINED(@IMPLEMENTATIONTYPE tinyint
    @SPECXML xml)
returns bit
as
begin

    declare @RETURNVALUE bit;

    /* First check to see if the data list is not implemented as a stored procedure, since in this case we can just
     return without having to query the data list spec XML. */
    if @IMPLEMENTATIONTYPE <> 0 
        set @RETURNVALUE = 0;

    if @RETURNVALUE is null
    begin
        with xmlnamespaces('bb_appfx_datalist' as ns, 'bb_appfx_commontypes' as c)
        select @RETURNVALUE = case when @SPECXML.value('ns:DataListSpec[1]/c:MetaTags[1]/AdHocQuerySaveDataListRequest[1]', 'nvarchar(max)') is null then 0
        else 1 end;
    end;

    return @RETURNVALUE;

end;