UFN_SPONSORSHIPOPPORTUNITY_HASSOLESPONSORSHIP

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@SPONSORSHIPOPPORTUNITYID uniqueidentifier IN

Definition

Copy


create function dbo.UFN_SPONSORSHIPOPPORTUNITY_HASSOLESPONSORSHIP(
  @SPONSORSHIPOPPORTUNITYID uniqueidentifier
)
returns bit
with execute as caller
as begin
  declare @SOLESPONSOREXISTS bit = 0;

  --it's okay to select the first row since there will only ever be multiple rows that are all 0, or one row that is 1,

    select 
      @SOLESPONSOREXISTS = ISSOLESPONSORSHIP 
    from dbo.SPONSORSHIP
    where SPONSORSHIPOPPORTUNITYID = @SPONSORSHIPOPPORTUNITYID
    and STATUSCODE in(0,1)

    return @SOLESPONSOREXISTS
end