UFN_CAMPAIGNHIERARCHY_NODES

This function is used by the datalist backing the campaign page navigation tree.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@HIERARCHYPATH hierarchyid IN

Definition

Copy


            create function dbo.UFN_CAMPAIGNHIERARCHY_NODES (
                @HIERARCHYPATH hierarchyid
            ) returns @NODES table (
                CONTEXTID uniqueidentifier,
                CAPTION nvarchar(100),
                PAGEID uniqueidentifier,
                NODES xml
            ) as begin
                insert into 
                    @NODES
                select
                    CAMPAIGN.ID as CONTEXTID,
                    CAMPAIGN.NAME as CAPTION,
                    'c4fd3595-e410-4be6-b70e-e0660f40b6aa' as PAGEID,
                    (select * from dbo.UFN_CAMPAIGNHIERARCHY_NODES(CAMPAIGN.HIERARCHYPATH) for xml raw('NODE'), elements, type) as NODES
                from
                    dbo.CAMPAIGN
                where
                    CAMPAIGN.HIERARCHYPATH.GetAncestor(1) = @HIERARCHYPATH;

                return;
            end