I´m trying to get my result into a temp table but can´t get it to work.
DECLARE @query nvarchar(max)
SET @query = N'SELECT * INTO ##TmpTbl FROM (SELECT * FROM Tbl1)'
EXEC(@query)
What am i doing wrong?
NOTE: I can NOT pre define temp table/table variable because of the actual question being run is a pivot question without pre defined columns in it´s result.