USE Northwind
GO
DECLARE @Counter INT
DECLARE @EmployeeID INT
DECLARE Employees_Cursor CURSOR FOR
SELECT EmployeeID FROM Employees
OPEN Employees_Cursor
FETCH NEXT FROM Employees_Cursor into @EmployeeID
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT * FROM Orders WHERE EmployeeID = @EmployeeID
FETCH NEXT FROM Employees_Cursor into @EmployeeID
END
CLOSE Employees_Cursor
DEALLOCATE Employees_Cursor
No comments:
Post a Comment