UFN_OPPORTUNITIESPROCESS_DESIGNATION_ISUNIQUE

Checks if Designations within Add Opportunity process are unique

Return

Return Type
int

Parameters

Parameter Parameter Type Mode Description
@ADDOPPORTUNITIESPROCESSID uniqueidentifier IN
@DESIGNATIONID uniqueidentifier IN

Definition

Copy


        create function dbo.UFN_OPPORTUNITIESPROCESS_DESIGNATION_ISUNIQUE
        (
            @ADDOPPORTUNITIESPROCESSID uniqueidentifier,
            @DESIGNATIONID uniqueidentifier
        )
        returns integer
        with execute as caller
        as begin

            declare @return integer
            declare @count integer
            set @return = 1

            if @DESIGNATIONID is not null
            begin
            select @count=count(*) from ADDOPPORTUNITIESPROCESSOPPORTUNITYDESIGNATION 
                        where DESIGNATIONID = @DESIGNATIONID and ADDOPPORTUNITIESPROCESSID = @ADDOPPORTUNITIESPROCESSID

                if @count > 1
                    set @return = 0 ;
            end

            return @return ;                
        end