Do CTEs use any space in tempdb?
Do CTEs use any space in tempdb or does it use memory exclusively? I've tagged the question with both mssql 2005 and 2008 as I use both. I'll try not to copy/paste MSDN It doesn't matter. A CTE is independent of query execution: it is only a language construct. Think of it as neat derived table or subquery. This means that except for recursive CTEs (see later), all CTEs can be coded inline. If you use the CTE code once, it is for readability . If you use the CTE twice or more, then it is defensive: you don't want to make a mistake and have the derived table different each use. Where a CTE is