Unlike Alex K comments, the local temporary table is visible in all internal areas within the join. The following snippet works fine:
create table
You can also use insert ... exec with temporary tables:
create table
If this does not work, send the exact error. One possible culprit is that insert ... exec requires a strict definition of the table column and query.
source share