UFN_CLASS_VALIDATESECTION
Validates that the specified section for the class specified.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CLASSID | uniqueidentifier | IN | |
@COURSEID | uniqueidentifier | IN | |
@SECTION | nvarchar(20) | IN | |
@STARTDATE | date | IN | |
@ENDDATE | date | IN |
Definition
Copy
create function dbo.UFN_CLASS_VALIDATESECTION
(
@CLASSID uniqueidentifier,
@COURSEID uniqueidentifier,
@SECTION nvarchar(20),
@STARTDATE date,
@ENDDATE date
)
returns bit
with execute as caller
as begin
-- Overlapping classes may not have duplicate section numbers.
return case when exists
(
select CLASS.ID
from dbo.CLASS
where (@CLASSID is null or CLASS.ID <> @CLASSID) and
CLASS.COURSEID = @COURSEID and
CLASS.SECTION = @SECTION and
(
(CLASS.STARTDATE between @STARTDATE and @ENDDATE) or
(CLASS.ENDDATE between @STARTDATE and @ENDDATE) or
((CLASS.STARTDATE <= @STARTDATE) and (CLASS.ENDDATE >= @ENDDATE))
)
)
then 0
else 1
end
end