• Nice article. I've used this type of method often, and this article explains it very well.

    Using RowNumber() could be avoided by adding an identity column on the new_purchase table and order the data on insert into new_purchase. This would obviously only work if you can order the data before or on insert into new_purchase.