• Do you know that cursors' performance is nearly the same to the set-based statements when they are run on up to about 1000 rows. In your case 2 million rows for a cursor will burn the cpu.

    You should find a set-based solution, which is not complex for your case. You can use temp tables or CTEs...

    Igor Micev,My blog: www.igormicev.com