UFN_REVENUESPLIT_GETTOP10CAMPAIGNSINONEROW

Returns the top 10 campaigns (based on name order) for a revenue split in a single row.

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@REVENUESPLITID uniqueidentifier IN

Definition

Copy


            create function dbo.UFN_REVENUESPLIT_GETTOP10CAMPAIGNSINONEROW
            (
                @REVENUESPLITID uniqueidentifier
            )
            returns table
            as
            return
            (
                select
                    CAMPAIGN1.CAMPAIGN as CAMPAIGN1,

                    CAMPAIGN2.CAMPAIGN as CAMPAIGN2,

                    CAMPAIGN3.CAMPAIGN as CAMPAIGN3,

                    CAMPAIGN4.CAMPAIGN as CAMPAIGN4,

                    CAMPAIGN5.CAMPAIGN as CAMPAIGN5,

                    CAMPAIGN6.CAMPAIGN as CAMPAIGN6,

                    CAMPAIGN7.CAMPAIGN as CAMPAIGN7,

                    CAMPAIGN8.CAMPAIGN as CAMPAIGN8,

                    CAMPAIGN9.CAMPAIGN as CAMPAIGN9,

                    CAMPAIGN10.CAMPAIGN as CAMPAIGN10
                from 
                    dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 1) as CAMPAIGN1
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 2) as CAMPAIGN2
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 3) as CAMPAIGN3
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 4) as CAMPAIGN4
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 5) as CAMPAIGN5
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 6) as CAMPAIGN6
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 7) as CAMPAIGN7
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 8) as CAMPAIGN8
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 9) as CAMPAIGN9
                    outer apply dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER(@REVENUESPLITID, 10) as CAMPAIGN10
            )