UFN_EDUCATIONALDIVISIONCODE_GETID_FROMNAME

Return

Return Type
uniqueidentifier

Parameters

Parameter Parameter Type Mode Description
@Description nvarchar(100) IN
@IsAffiliated bit IN
@AcademicCatalogOn bit IN

Definition

Copy


create function dbo.UFN_EDUCATIONALDIVISIONCODE_GETID_FROMNAME(
@Description nvarchar(100),
@IsAffiliated bit = 0,
@AcademicCatalogOn bit = 0
)
RETURNS uniqueidentifier WITH EXECUTE AS CALLER
AS
begin
    declare @RETURNVALUE uniqueidentifier;

  if @IsAffiliated = 1 and @AcademicCatalogOn = 1
  begin
      select top 1 @RETURNVALUE = ID
      from
      dbo.ACADEMICCATALOGDIVISION AC
      where AC.NAME = @Description;
  end
  else
  begin
      select top 1 @RETURNVALUE = ID
      FROM 
      dbo.EDUCATIONALDIVISIONCODE EC
      where EC.DESCRIPTION = @Description;
  end

    return @RETURNVALUE;
end