Currently we have a query that forecast income for direct debit products. This Query uses permanent tables opposed to temp tables as the query use Dynamic SQL and temp tables could not be seen outside the scope of that dynamic SQL execution.
What I want to do is put them into a stored procedure using global temp tables to get round the out of scope issue with temp tables. My question is if they are never run in parallel and only sequentially will these global temp tables be deleted once the stored procedure has run like normal temp tables? Or because they are global will they be left in the tempdb?
Also please note I have looked into insert into table method but sadly as per my comment below we use around 1000 tables to create the final output.