RBarryYoung (3/2/2010)
And you know, this would all be a lot easier and simpler if you did this in a set-based way, instead of using a CURSOR and WHILE loops.
This is quite a tricky one to do set-based, and there's no performance advantage. Why bother?
I can write the dynamic SQL and cursor version in ten minutes - I'd have to think hard about a set-based version.
Just interested.
Paul
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi