alter proc updateStudent
@id int,
@id2 int
as
declare @SchoolID int
declare @ClassID int
declare @StudentID int
declare @IDNumber int
declare @IDAAA int
begin
declare FeeInsertStudent cursor for
select stuID,SchID,ClasID from T_School where ID=@id
open FeeInsertStudent
fetch next from FeeInsertStudent into @SchoolID,@ClassID,@StudentID
while @@FETCH_STATUS=0
begin
set @IDNumber=(select count(*) from T_LeaveSchool where StudentID=@StudentID and SchoolID=@SchoolID and ClassId=@ClassID)
set @IDAAA=(select COUNT(*) from T_LeaveSchool where ID=@id2)
if(@IDNumber!=0)
if(@IDAAA!=0)
begin
update T_LeaveSchool set StudentID=@StudentID,ClassID=@ClassID,SchoolID=@StudentID where ID=@id2
end
fetch next from FeeInsertStudent into @SchoolID,@ClassID,@StudentID
end
close FeeInsertStudent
deallocate FeeInsertStudent
end