I want to create a temporary table using a While Loop instead of a Cursor.
Why? If you're trying to remove the cursor, a while loop is no better. Just another form of row-by-row processing.
Is the end goal to use a cursor/loop, or is the end goal to populate a table?
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass