question

dk_apr avatar image
dk_apr asked

Can we join CTE & Temp table inside stored procedure in SQL server?

dk_apr Can we join CTE & Temp table inside stored procedure in SQL server?

joinstored procedures
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Magnus Ahlkvist avatar image
Magnus Ahlkvist answered

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.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.