我创建了一个标量值函数,其中包含以下(部分)代码:
declare @start_time22 time(7);
select @start_time22=Courses.[Course start time] from Courses where [Course ID]=@val1 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
该函数总是返回值“ 5 ”,所以我想知道我是否可以首先比较类型时间......还是我的代码有问题???