UFN_SPONSORSHIPOPPORTUNITY_SPONSORSPEROPPORTUNITY

Returns the maximum number of sponsors allowed for an opportunity based on its group and location.

Return

Return Type
smallint

Parameters

Parameter Parameter Type Mode Description
@SPONSORSHIPOPPORTUNITYGROUPID uniqueidentifier IN
@SPONSORSHIPLOCATIONID uniqueidentifier IN

Definition

Copy


CREATE function dbo.UFN_SPONSORSHIPOPPORTUNITY_SPONSORSPEROPPORTUNITY(
    @SPONSORSHIPOPPORTUNITYGROUPID uniqueidentifier,
    @SPONSORSHIPLOCATIONID uniqueidentifier
)
returns smallint
with execute as caller
as begin
    declare @SPONSORSPEROPPORTUNITY smallint
    declare @OVERRIDES xml

    select @SPONSORSPEROPPORTUNITY = SPONSORSPEROPPORTUNITY,
           @OVERRIDES = OVERRIDESPONSORSPEROPPORTUNITY
    from dbo.SPONSORSHIPOPPORTUNITYGROUP
    where ID = @SPONSORSHIPOPPORTUNITYGROUPID;

    if @OVERRIDES is not null
      set @SPONSORSPEROPPORTUNITY = isnull(dbo.UFN_SPONSORSHIPOPPORTUNITY_OVERRIDES_SPONSORSPEROPPORTUNITY(@SPONSORSHIPLOCATIONID, @OVERRIDES), @SPONSORSPEROPPORTUNITY)

  return @SPONSORSPEROPPORTUNITY
end