UFN_RELATIONSHIP_VALIDSPOUSE

Validates whether the spouse record is valid.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ISSPOUSE bit IN
@SPOUSEID uniqueidentifier IN

Definition

Copy


            CREATE function dbo.UFN_RELATIONSHIP_VALIDSPOUSE(@ISSPOUSE bit, @SPOUSEID uniqueidentifier) returns bit with execute as caller
            AS
            BEGIN

                declare @ISORGANIZATION bit;
                declare @ISGROUP bit;

                if @ISSPOUSE = 0 
                begin                    
                    return 1;
                end 
                else 
                begin
                    select 
                        @ISORGANIZATION = ISORGANIZATION,
                        @ISGROUP = ISGROUP
                    from 
                        dbo.CONSTITUENT 
                    where 
                        ID = @SPOUSEID;

                    if @ISORGANIZATION = 0 and @ISGROUP = 0
                        return 1;
                    else
                        return 0;                    
                end

                return 0;
            end