UFN_SPONSORSHIP_SOLESPONSORSHIPVALID
Validates that sole sponsorships are valid and honored.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@SPONSORSHIPOPPORTUNITYID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_SPONSORSHIP_SOLESPONSORSHIPVALID(
@SPONSORSHIPOPPORTUNITYID uniqueidentifier
)
returns bit
with execute as caller
as begin
declare @TOTALCOUNT smallint
declare @SOLESPONSOREXISTS bit
select @TOTALCOUNT = count(*),
@SOLESPONSOREXISTS = max(case when ISSOLESPONSORSHIP = 1 then 1 else 0 end)
from dbo.SPONSORSHIP
where SPONSORSHIPOPPORTUNITYID = @SPONSORSHIPOPPORTUNITYID
and STATUSCODE in(0,1)
if @SOLESPONSOREXISTS = 1 and @TOTALCOUNT > 1
return 0;
return 1;
end