UFN_TERM_DATESWITHINAYDATES
Check to see if the term start date and end date are within the academic year dates.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@SESSIONID | uniqueidentifier | IN | |
@STARTDATE | datetime | IN | |
@ENDDATE | datetime | IN |
Definition
Copy
create function dbo.UFN_TERM_DATESWITHINAYDATES
(
@SESSIONID uniqueidentifier,
@STARTDATE datetime,
@ENDDATE datetime)
returns BIT
as begin
-- We are not checking scholarship terms right now (only session terms)
if @SESSIONID is null
return 1;
-- Make sure the data is OK...
if (@STARTDATE > @ENDDATE)
begin
declare @DATESWAP datetime;
set @DATESWAP = @ENDDATE;
set @ENDDATE = @STARTDATE;
set @STARTDATE = @DATESWAP;
end
declare @AYSTARTDATE datetime, @AYENDDATE datetime
select @AYSTARTDATE = AY.STARTDATE, @AYENDDATE = AY.ENDDATE
from dbo.ACADEMICYEAR AY
inner join dbo.SESSION on SESSION.ACADEMICYEARID = AY.ID
where SESSION.ID = @SESSIONID
if (@AYSTARTDATE <= @STARTDATE and @AYENDDATE >= @ENDDATE)
return 1;
return 0;
end