我有 2 张桌子,StudentRegsitre 和 Agenda,
议程表有 (AgendaId, MatirelId, InstructorId, ClassId, addedDate, Semester, StartTime, EndTime, DaySchedule) StudentRegsitre (Id, AgendaId, UserId)
需要通过从 ASP.NET C# 传递 studentId 检查 StartTime 、 EndTime、 DaySchedule 、 classid 来检查 studentRegsitre 中是否存在重叠
我试试这个:
GO
Create procedure [dbo].[SP_OverLappingExists] (@AgendaId uniqueidentifier ,@UserId uniqueidentifier )
As Begin
Declare @CurrentAgendaId uniqueidentifier;
declare @MatirelId uniqueidentifier;
declare @InstructorId uniqueidentifier;
declare @ClassId uniqueidentifier;
declare @Semester nchar(10);
declare @StartTime time(7);
declare @EndTime time (7);
declare @DaySchedule varchar(50);
declare @UserIdNew uniqueidentifier;
declare @AgendaIdNew uniqueidentifier;
if exists (SELECT @CurrentAgendaId = Agenda.AgendaId,@MatirelId= Agenda.MatirelId,
@InstructorId= Agenda.InstructorId,@ClassId= Agenda.ClassId,@Semester= Agenda.Semester,
@StartTime= Agenda.StartTime,@EndTime= Agenda.EndTime,@DaySchedule= Agenda.DaySchedule,
@UserIdNew= StudentReg.UserId, @AgendaIdNew= StudentReg.AgendaId
FROM Agenda INNER JOIN
StudentReg ON Agenda.AgendaId = StudentReg.AgendaId
where StudentReg.UserId = @UserId
)
begin
return 1
end
但它在@currentAgendaId = Agenda.AgendaId 附近出现错误“'=' 附近的语法不正确”有什么帮助,如果有更好的想法,请与我分享。!
ps:是Study case。