I have an existing query that outputs current data, and I would like to insert it into a Temp table, but am having some issues doing so. Would anybody have some insight on h
SQL Server R2 2008 needs the AS clause as follows:
SELECT *
INTO #temp
FROM (
SELECT col1, col2
FROM table1
) AS x
The query failed without the AS x at the end.
It's also needed when using SS2016, had to add as t to the end.
Select * into #result from (SELECT * FROM #temp where [id] = @id) as t //<-- as t