sagesmith (6/18/2013)
Please post the times each approach takes, this is the only basis for a conclusion. As others have already mentioned, in many scenarios the cursor far outperforms the recursive cte.
Over to you then. Sample data setup is a page or two back. I've compared iTally vs rCTE here:
http://www.sqlservercentral.com/Forums/FindPost1464526.aspx
Feel free to write your fastest cursor-based solution ๐
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden