A database cursor allows you to loop through a set of selected records and operate on one row at a time.
Try to avoid using cursors as they sidestep the query optimisation available in SQL Server, and will run slowly. Any selection scenario can be run as SQL without using a cursor – although sometimes this will have to be Advanced SQL.
DECLARE @var int DECLARE cur CURSOR FOR SELECT Id FROM ToDoLists OPEN cur FETCH NEXT FROM cur INTO @var WHILE @@FETCH_STATUS=0 BEGIN /* do something with @var */ FETCH NEXT FROM cur INTO @var END CLOSE cur DEALLOCATE cur