UFN_DESIGNATION_ISVALID

Validates that the designation node has no unspecified levels.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@DESIGNATIONLEVEL2ID uniqueidentifier IN
@DESIGNATIONLEVEL3ID uniqueidentifier IN
@DESIGNATIONLEVEL4ID uniqueidentifier IN
@DESIGNATIONLEVEL5ID uniqueidentifier IN

Definition

Copy


            create function dbo.UFN_DESIGNATION_ISVALID
            (
                @DESIGNATIONLEVEL2ID uniqueidentifier,
                @DESIGNATIONLEVEL3ID uniqueidentifier,
                @DESIGNATIONLEVEL4ID uniqueidentifier,
                @DESIGNATIONLEVEL5ID uniqueidentifier
            )
            returns bit
            with execute as caller
            as 
            begin
                declare @r bit;

                if @DESIGNATIONLEVEL5ID is not null
                    begin
                    if (@DESIGNATIONLEVEL4ID is not null) and
                        (@DESIGNATIONLEVEL3ID is not null) and
                        (@DESIGNATIONLEVEL2ID is not null

                        set @r = 1;
                    else
                        set @r = 0;
                    end
                else
                    if @DESIGNATIONLEVEL4ID is not null
                        begin
                        if (@DESIGNATIONLEVEL3ID is not null) and
                            (@DESIGNATIONLEVEL2ID is not null)                             
                            set @r = 1;
                        else
                            set @r = 0;
                        end
                    else
                        if @DESIGNATIONLEVEL3ID is not null
                            begin
                            if (@DESIGNATIONLEVEL2ID is not null)                                 
                                set @r = 1;
                            else
                                set @r = 0;
                            end
                        else
                            set @r = 1;

                return @r
            end