I have to iterate through a set of records using while loop. But using while loop it takes about 12 seconds for just 2000 records.
I created a temporary table #
#