UFN_ADHOCQUERY_QUERYVIEWSINUSE

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@QUERYDEFINITIONXML xml IN

Definition

Copy

CREATE function dbo.UFN_ADHOCQUERY_QUERYVIEWSINUSE(@QUERYDEFINITIONXML xml)
returns @T table (OBJECTNAME nvarchar(128))
as
begin

    with xmlnamespaces ('Blackbaud.AppFx.WebService.API.1' as [ns])
    insert into @T (OBJECTNAME) select T.c.value('@ObjectName', 'nvarchar(128)'
        from @QUERYDEFINITIONXML.nodes('ns:AdHocQuery/*/ns:f[@ObjectName!='''']') as T(c);

    with xmlnamespaces ('Blackbaud.AppFx.WebService.API.1' as [ns])
    insert into @T (OBJECTNAME) select OBJECTNAME from dbo.QUERYVIEWCATALOG where ID = @QUERYDEFINITIONXML.value('ns:AdHocQuery[1]/ns:QueryView[1]/@ID', 'uniqueidentifier');

    return;
end;