UFN_SEARCHLIST_TASKREFERENCES

Returns a table of task IDs that reference the given search list.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@SEARCHLISTID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_SEARCHLIST_TASKREFERENCES
(
    @SEARCHLISTID uniqueidentifier
)
returns @TABLE table
(
    TASKID uniqueidentifier
)
with execute as caller
as
begin

    with xmlnamespaces ('bb_appfx_commontypes' as common)
    insert into @TABLE
        select distinct T.ID
        from dbo.TASKCATALOG as T
            cross apply T.TASKSPECXML.nodes('//common:SearchListReturnValue') as task(context)
        where task.context.value('@SearchListID', 'uniqueidentifier') = @SEARCHLISTID;

    return;

end;