There is some controversy about using cursors in TSQL. Overall, I believe they tend to tie up resources and are seen as bad. So how do you get around using them? Here’s how.
You can see how cursors are used in my post at TSQL – Simple Loop Through Result Set Using Cursor
To NOT use cursors, you must create a temp table with a “flag” column to indicate whether or not it has been processed yet. Then, rather than updating the cursor, you update the flag column. Here’s an example: