UFN_MEMBER_VALIDMEMBER

Validates that a member is only added to a membership once.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@MEMBERSHIPID uniqueidentifier IN
@CONSTITUENTID uniqueidentifier IN
@ID uniqueidentifier IN

Definition

Copy



        CREATE function dbo.UFN_MEMBER_VALIDMEMBER 
        (
            @MEMBERSHIPID uniqueidentifier,
            @CONSTITUENTID uniqueidentifier,
            @ID uniqueidentifier
        )
        returns bit with execute as caller
        as begin
            if exists
            (
                select
                    1
                from
                    dbo.MEMBER
                where
                    MEMBERSHIPID = @MEMBERSHIPID
                    and CONSTITUENTID = @CONSTITUENTID
                    and ISDROPPED = 0
                group by
                    CONSTITUENTID
                having
                    count(*) > 1
            )
                return 0;

            return 1;
        end