Code:
create function OutstandingBooks() returns table as BEGIN declare @TodaysDate date = getdate(), @CountStart int = 1, @CountRows int, @ReturnDate date, @Name varchar (50) select @CountRows = count (rows) +1 from SignOut_TM while (@CountStart <> @CountRows) begin select top (@CountStart) @ReturnDate = ReturnDate from SignOut_TM if (@TodaysDate > @ReturnDate) begin select @Name = EmployeName from SignOut_TM where ReturnDate = @ReturnDate end return select EmployeeName,CourseName,BookName,TodaysDate where EmployeeName = @Name set @CountStart += 1 end END
what am I dong wrong?
Comment