UFN_REVENUEBATCH_GETAPPLICATIONBUSINESSUNITS_FROMITEMLISTXML

Used to convert an xml string to a table

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@ITEMLISTXML xml IN

Definition

Copy


create function dbo.UFN_REVENUEBATCH_GETAPPLICATIONBUSINESSUNITS_FROMITEMLISTXML(@ITEMLISTXML xml)
    returns table as
    return (
        select
            T.c.value('(APPLICATIONID)[1]','uniqueidentifier') AS 'APPLICATIONID',
            T.c.value('(REVENUESPLITID)[1]','uniqueidentifier') AS 'REVENUESPLITID',
            T.c.value('(OVERRIDEBUSINESSUNITS)[1]','bit') AS 'OVERRIDEBUSINESSUNITS',
         T.c.value('(REASON)[1]','uniqueidentifier') AS 'REASON',
           case when T.c.exist('./BUSINESSUNITS/ITEM') = 1 then T.c.query('(BUSINESSUNITS)[1]') else null end as 'BUSINESSUNITS'
        from @ITEMLISTXML.nodes('/APPLICATIONBUSINESSUNITS/ITEM') T(c)
    )