Hello Kai,
the need for that requirement is not really clear to me, but I think you are just trying out some things
.
You can use Dynamic SQL statement EXEC for that in combination with a global temporary table. You have to build a statement that inserts the selected results into the global temporary table. This is necessary, because within dynamic sql you cannot address any SQLScript variables.
But please consider the notes for the dynamic sql regarding security and performance.
I would not recommend to use such an approach for a productive scenario. Trying it out and deleting it afterwards is ok
.
Best Regards,
Florian