UFN_SPONSORSHIP_ACTIVESPONSORSHIPCOUNT

For verifying that a sponsorship commitment only has one active sponsorship.

Return

Return Type
smallint

Parameters

Parameter Parameter Type Mode Description
@COMMITMENTID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_SPONSORSHIP_ACTIVESPONSORSHIPCOUNT(
    @COMMITMENTID uniqueidentifier
)
returns smallint
with execute as caller
as begin
    declare @COUNT smallint

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

    return @COUNT
end