UFN_SPONSORSHIPOPPORTUNITY_ACTIVESPONSORSHIPS

A count of the active sponsorships associated with a sponsorship opportunity.

Return

Return Type
smallint

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_SPONSORSHIPOPPORTUNITY_ACTIVESPONSORSHIPS(
@ID uniqueidentifier
)
returns smallint
with execute as caller
as begin
    declare @COUNT smallint

    select @COUNT = count(*)
    from dbo.SPONSORSHIP
    where SPONSORSHIPOPPORTUNITYID = @ID
    and STATUSCODE = 1

  if @COUNT <> 0
     return @COUNT;

  return 0;
end