SQL Server - Cursors - Missing Afterthought - Safeguard against infinite looping in case of missing FETCH NEXT
To avoid problems like this I'm using different patter for fetch:

OPEN Cursor;

WHILE 1=1
BEGIN 

    FETCH NEXT FROM Cursor INTO [...];
    IF @@FETCH_STATUS &lt;&gt; 0 BREAK;

    [...]

END;

CLOSE Cursor;
DEALLOCATE Cursor;


In this pattern you have FETCH exactly once and then you need to check fetch status once too.