I may be missing something here, but why use a While loop for this kind of thing? Do a set-based merge of all the update data, then upsert it into the master table. Two steps, very simple, very clean, no While loop.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon