TSQL – Loop Through Result Set WITHOUT Cursors

ben himself's picture

There is a time and a place for everything, cursors included. Here is one way to avoid using them.

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:



Subscribe to RSS - cursors