not sure what ur saying about the selecting for a cte because u can sdo that w/ the #tables as well.
I like the #tables in development because i can see what is in them after the process runs and so on
Right, I was just saying that you could do the same with CTE's, not that you COULDN'T do it with temp tables. The way your statement read, it seemed like you were arguing that as a reason to use temp tables instead of CTE's.
Granted, because of the single query limitations of CTE's, you can't do 20 different operations to them and then view them as easily as you could a temp table (although CTE's can refer to any cte above them, so you can do multiple operations to them, but then you start getting into areas where temp tables might be better), so they're not always as easy to deal with. That said, a programming method should not be chosen just because it is easier, especially in SQL.
Consistency is only a virtue if you're not a screwup. ;-)Links
: How to Post Sample Data
:: Running Totals
:: Tally Table
:: Cross Tabs/Pivots
:: String Concatenation