I am using a dynamic query in SQL which returns me a large data set which I need to insert into a temporary table.
Does SELECT INTO #tmp from EXEC sp_executesql @query work?
I did try it out but I get an error 'Incorrect syntax near the keyword 'EXEC'
I know that it works using Insert into, but I don't want to create the table manually as it is a large table with a lot of columns. Is there an alternative without having to creating the temp table manually?