I agree. Beer popsicles are in order for this one. Thanks for sharing the nature of it all. Heh... sounds like a lot of "fun". This one is definitely not a job for SQL Server alone.
--Jeff Moden
RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row. First step towards the paradigm shift of writing Set Based code: ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
Change is inevitable... Change for the better is not.