UFN_GRADINGSCALEGRADE_NUMERICEQUIVALENTISUNIQUE

Returns whether the grading scale already contains a grade with the same numeric value.

Return

Return Type
bit

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN
@GRADINGSCALEID uniqueidentifier IN
@NUMERICEQUIVALENT decimal(20, 2) IN

Definition

Copy


create function dbo.UFN_GRADINGSCALEGRADE_NUMERICEQUIVALENTISUNIQUE
(
    @ID uniqueidentifier,
    @GRADINGSCALEID uniqueidentifier,
    @NUMERICEQUIVALENT decimal (20,2)
)
returns bit
as begin
    declare @RETVAL int = 1

    if (exists (select NUMERICEQUIVALENT
               from dbo.GRADINGSCALEGRADE
               where GRADINGSCALEID = @GRADINGSCALEID
                    and NUMERICEQUIVALENT = @NUMERICEQUIVALENT
                    and ID <> @ID))
        set @RETVAL = 0;

    return @RETVAL;
end