insert results of select into temp table sql server code example
Example: select into temp table
SELECT *
INTO #temp
FROM (
SELECT col1, col2
FROM table1
) AS x
SELECT *
INTO #temp
FROM (
SELECT col1, col2
FROM table1
) AS x