UFN_SPONSORSHIP_ID_FROM_REVENUEID
Returns either the first or last payment date associated with a sponsorship.
Return
Return Type |
---|
uniqueidentifier |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_SPONSORSHIP_ID_FROM_REVENUEID
(
@ID uniqueidentifier
)
returns uniqueidentifier
with execute as caller
as begin
declare @SPONSORSHIPID as uniqueidentifier;
select
@SPONSORSHIPID = S.ID
from dbo.REVENUE R
inner join dbo.REVENUESPLIT RS on R.ID = RS.REVENUEID
inner join dbo.SPONSORSHIP S on S.REVENUESPLITID = RS.ID
where R.ID = @ID
and S.ISMOSTRECENTFORCOMMITMENT = 1;
return @SPONSORSHIPID;
end