UFN_OPPORTUNITYDESIGNATION_ISUNIQUE_2

Checks if Opportunity Designations follow appropriate uniqueness rules.

Return

Return Type
bit

Parameters

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

Definition

Copy


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

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

            return 1;
        end