UFN_EDUCATIONALDEPARTMENTCODEEXTENSION_VALIDSHORTCODE

Determines whether the short code for the educational department code table entry is valid.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN
@SHORTCODE nvarchar(25) IN

Definition

Copy


create function dbo.UFN_EDUCATIONALDEPARTMENTCODEEXTENSION_VALIDSHORTCODE
(
  @ID uniqueidentifier,
  @SHORTCODE nvarchar(25)
)
returns bit
as begin
    declare @valid bit
  set @valid = 1;

  if exists (select 1 from dbo.EDUCATIONALDEPARTMENTCODEEXTENSION where ID <> @ID and SHORTCODE = @SHORTCODE)
    set @valid = 0;

    return @valid
end