dk_apr Can we join CTE & Temp table inside stored procedure in SQL server?
There's not much to work on in your question.
But to narrow it down.
1) A temp table and a common table expression can be joined, either in another common table expression or in the outer query, referencing the common table expression.
2) Since you can use SELECT-statements in stored procedures (as well as updates, inserts, deletes and most other TSQL-commands), then yes, you can join a CTE with a temporary table inside a stored procedure, just as long as the temporary table exists in the scope of the stored procedure execution.
17 People are following this question.