• Two problems here, one significant, one not so. The significant problem seems to be that the proc works based on the assumption that the state of the Order table doesn't change (i.e., no inserts, deletes, updates to cluster key values). Obviously if the state of the table changes, working with relative rowcounts is invalid (although the order by option MIGHT save you here). Second, the lesser of the two, is simply the performance, resource and locking implications of using a cursor, an approach which might be entirely valid under several scenarios.