• WayneS (6/28/2011)


    wbrianwhite (6/28/2011)


    I'm not sure why you're keeping this in a cursor at all. The report looks simple enough to just write the entire report as a big select statement. Which will be an order of magnitude faster than a cursor.

    Surely you did notice that this article is "Part 1"? I would suspect that "Part 2" takes care of that! 😉

    I just looked at it now that it's up. It uses a temp table and a lot of outer apply functions and multiple CTEs. It is a simple enough report to write as just a select. Anything else seems like the wrong tool. Keep it simple and describe what you want in your sql, not how to get it.