UFN_SPONSORSHIPOPPORTUNITYGROUP_ACTIVESPONSORSHIPCOUNT
Count of active sponsorships for opportunities in an opportunity group.
Return
Return Type |
---|
int |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_SPONSORSHIPOPPORTUNITYGROUP_ACTIVESPONSORSHIPCOUNT(
@ID uniqueidentifier
)
returns int
with execute as caller
as begin
declare @COUNT int
select @COUNT = count(*)
from dbo.SPONSORSHIP
inner join dbo.SPONSORSHIPOPPORTUNITY on SPONSORSHIPOPPORTUNITY.ID = SPONSORSHIP.SPONSORSHIPOPPORTUNITYID
where SPONSORSHIPOPPORTUNITY.SPONSORSHIPOPPORTUNITYGROUPID = @ID
and SPONSORSHIP.STATUSCODE in(0,1)
return @COUNT
end