UFN_SPONSORSHIP_OPPORTUNITYUNIQUEFORCONSTITUENTACTIVESPONSORSHIPS
Returns false if there is more than one active sponsorship for the constituent to the same opportunity.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CONSTITUENTID | uniqueidentifier | IN | |
@SPONSORSHIPOPPORTUNITYID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_SPONSORSHIP_OPPORTUNITYUNIQUEFORCONSTITUENTACTIVESPONSORSHIPS(
@CONSTITUENTID uniqueidentifier,
@SPONSORSHIPOPPORTUNITYID uniqueidentifier
)
returns bit
with execute as caller
as begin
declare @COUNT smallint
select @COUNT = count(*)
from dbo.SPONSORSHIP
where CONSTITUENTID = @CONSTITUENTID
and SPONSORSHIPOPPORTUNITYID = @SPONSORSHIPOPPORTUNITYID
and STATUSCODE in(0,1)
if @COUNT > 1
return 0
return 1
end