UFN_SYSTEMROLEADGROUP_ISUNIQUE

Validates whether the active directory group specified is unique for this role.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@SYSTEMROLEID uniqueidentifier IN
@GROUPID varbinary IN
@LDAPQUERY nvarchar(4000) IN

Definition

Copy


        create function dbo.UFN_SYSTEMROLEADGROUP_ISUNIQUE
        (
            @SYSTEMROLEID uniqueidentifier,
            @GROUPID varbinary(85),
            @LDAPQUERY nvarchar(4000)
        )
        returns bit
        with execute as caller
        as begin
            declare @DUPLICATECOUNT int;

            select
                @DUPLICATECOUNT = count(*)
            from
                dbo.SYSTEMROLEADGROUP
            where
                SYSTEMROLEID = @SYSTEMROLEID and
                (GROUPID = @GROUPID or (GROUPID is null and @GROUPID is null)) and
                (LDAPQUERY = @LDAPQUERY or (LDAPQUERY is null and @LDAPQUERY is null));

            if (@DUPLICATECOUNT <= 1)
                return 1;

            return 0;
        end