--------------------------------------------------------------------------------- Returns the status of the last cursor FETCH statement issued against any cursor currently opened by the connection. 0 = The FETCH statement was successful. -1 = The FETCH statement failed or the row was beyond the result set. -2 = The row fetched is missing. DECLARE Employee_Cursor CURSOR FOR SELECT EmployeeID, Title FROM AdventureWorks.HumanResources.Employee; OPEN Employee_Cursor; FETCH NEXT FROM Employee_Cursor; WHILE @@FETCH_STATUS = 0 BEGIN FETCH NEXT FROM Employee_Cursor; END; CLOSE Employee_Cursor; DEALLOCATE Employee_Cursor; GO ---------------------------------------------------------------------------------