select from temp table code example
Example 1: select into temp table
SELECT t.col1, t.col2...
INTO #temp
FROM table1 AS t
Example 2: select into temp table
SELECT *
INTO #temp
FROM (
SELECT col1, col2
FROM table1
) AS x
SELECT t.col1, t.col2...
INTO #temp
FROM table1 AS t
SELECT *
INTO #temp
FROM (
SELECT col1, col2
FROM table1
) AS x