• Martins answer is a lot sweeter and more robust if you need to loop through a data set, as there is no guarantee that the numbers are consecutive eg record number 4 is deleted for some reason (yes it can happen), so the last record will never get updated, assuming a 1% row deletion count, then in an organisation with 1000 members, 10 wont get pay rises.

    As always the advice is use set based queries rather than Loops and Cursors, though in some cases you have to revert to them they should be rare.

    As an aside, one of my colleagues ran some internal tests on a somewhat larger data set (1000 rows, same number of columns) and found that the Cursor ran significantly faster than the last option.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices