我創建一個具有代碼在它下面(部分)標量值功能:比較類型時在SQL函數
declare @start_time22 time(7);
select @start_time22=Courses.[Course start time] from Courses where [Course ID][email protected] and [Course days]='monday wednesday';
if(@start_time22 is not null)
begin
IF (@start_time not between @start_time22 and @end_time22)
BEGIN
SET @Result = 1
END
ELSE
BEGIN
SET @Result = 0
END
IF (@end_time not between @start_time22 and @end_time22)
BEGIN
SET @Result = 1
END
ELSE
BEGIN
SET @Result = 0
END
end
else
begin
set @Result = 5
end
RETURN @Result
函數總是返回值「 「,所以我想知道如果我可以比較類型時間在第一個地方... 或有什麼問題,我的代碼?
'[課程天] ='週一wednesday''看起來很腥 – Andomar
@Andomar檢查了...不是問題! –
你在哪裏聲明@ endtime22? – Luv