• Good article, but I tend to disagree on the "roll your own" cursors.  I have seen several situations where using a cursor vastly outperformed the solution you seem to advocate.  This is particularly true where you are using explicit transactions for some reason.

    Over the years I have come to like, and rely on, derived tables and subqueries.  These are generally my "go to" option.  Then if I need to I'll use table variables.  Temp tables are generally the last thing I look at using and usually it's in situations where putting an index on them really helps.  Finally, using an indexed view can sometimes be a good alternative to temp tables.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/