UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER
Returns the campaigns for a revenue split that is in the given row number based on sorting by campaign name.
Return
| Return Type |
|---|
| table |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @REVENUESPLITID | uniqueidentifier | IN | |
| @ROWNUMBER | int | IN |
Definition
Copy
CREATE function dbo.UFN_REVENUESPLIT_GETCAMPAIGNBYROWNUMBER
(
@REVENUESPLITID uniqueidentifier,
@ROWNUMBER int
)
returns table
as
return
(
select
CAMPAIGN
from
(
select
row_number() over (order by DISTINCTCAMPAIGNS.NAME) as ROWNUMBER,
DISTINCTCAMPAIGNS.NAME as CAMPAIGN
from
(
select distinct
CAMPAIGN.NAME
from dbo.REVENUESPLITCAMPAIGN
inner join dbo.CAMPAIGN on REVENUESPLITCAMPAIGN.CAMPAIGNID = CAMPAIGN.ID
where REVENUESPLITCAMPAIGN.REVENUESPLITID = @REVENUESPLITID
) as DISTINCTCAMPAIGNS
) as SUBQ
where
ROWNUMBER = @ROWNUMBER
)