UFN_OPPORTUNITIESPROCESS_DESIGNATION_ISUNIQUE_2

Checks if Designations within Add Opportunity process follow appropriate uniqueness rules

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ADDOPPORTUNITIESPROCESSID uniqueidentifier IN
@DESIGNATIONID uniqueidentifier IN
@FUNDINGMETHODCODEID uniqueidentifier IN
@CATEGORYCODEID uniqueidentifier IN
@TYPECODEID uniqueidentifier IN
@USECODEID uniqueidentifier IN

Definition

Copy


        create function dbo.UFN_OPPORTUNITIESPROCESS_DESIGNATION_ISUNIQUE_2
        (
            @ADDOPPORTUNITIESPROCESSID uniqueidentifier,
            @DESIGNATIONID uniqueidentifier,
            @FUNDINGMETHODCODEID uniqueidentifier,
            @CATEGORYCODEID uniqueidentifier,
            @TYPECODEID uniqueidentifier,
            @USECODEID uniqueidentifier
        )
        returns bit
        with execute as caller
        as begin

            if exists
                (
                    select 1
                    from dbo.ADDOPPORTUNITIESPROCESSOPPORTUNITYDESIGNATION 
                    where ADDOPPORTUNITIESPROCESSID = @ADDOPPORTUNITIESPROCESSID
                    group by DESIGNATIONID, FUNDINGMETHODCODEID, CATEGORYCODEID, TYPECODEID, USECODEID
                    having (count(*) > 1)
                )
                return 0;

            return 1;            
        end