UFN_DESIGNATION_GETDESIGNATION

Returns the designation ID for the supplied designation levels.

Return

Return Type
uniqueidentifier

Parameters

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

Definition

Copy


            create function dbo.UFN_DESIGNATION_GETDESIGNATION
            (
                  @DESIGNATIONLEVEL1ID uniqueidentifier,
                  @DESIGNATIONLEVEL2ID uniqueidentifier = null,
                  @DESIGNATIONLEVEL3ID uniqueidentifier = null,
                  @DESIGNATIONLEVEL4ID uniqueidentifier = null,
                  @DESIGNATIONLEVEL5ID uniqueidentifier = null
            )
            returns uniqueidentifier
            with execute as caller
            as
            begin
                  declare @DESIGNATIONID uniqueidentifier;
                  select 
                        @DESIGNATIONID = ID
                  from 
                        dbo.DESIGNATION
                  where
                        DESIGNATIONLEVEL1ID = @DESIGNATIONLEVEL1ID
                        and (DESIGNATIONLEVEL2ID = @DESIGNATIONLEVEL2ID or (@DESIGNATIONLEVEL2ID is null and DESIGNATIONLEVEL2ID is null))
                        and (DESIGNATIONLEVEL3ID = @DESIGNATIONLEVEL3ID or (@DESIGNATIONLEVEL3ID is null and DESIGNATIONLEVEL3ID is null))
                        and (DESIGNATIONLEVEL4ID = @DESIGNATIONLEVEL4ID or (@DESIGNATIONLEVEL4ID is null and DESIGNATIONLEVEL4ID is null))
                        and (DESIGNATIONLEVEL5ID = @DESIGNATIONLEVEL5ID or (@DESIGNATIONLEVEL5ID is null and DESIGNATIONLEVEL5ID is null));
                  return @DESIGNATIONID;
            end