UFN_PLANNEDGIFTADDITION_DESIGNATION_ISUNIQUE

Checks if Designations within Planned Gift Additions are unique

Return

Return Type
int

Parameters

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

Definition

Copy


        create function dbo.UFN_PLANNEDGIFTADDITION_DESIGNATION_ISUNIQUE
        (
            @PLANNEDGIFTADDITIONID 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 PLANNEDGIFTADDITIONDESIGNATION 
                        where DESIGNATIONID = @DESIGNATIONID and PLANNEDGIFTADDITIONID = @PLANNEDGIFTADDITIONID

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

            return @return ;                
        end