INSERT INTO @table(a,b,c,d)
SELECT a,b,c,d
FROM table1
UNION
SELECT a,b,c,d
FROM table2
You do not need to use the Values clause when Inserting data using SELECT statement. Therefore I have removed the VALUES
bit from it and just simply doing a UNION of rows being returned from both SELECT queries.
Sql server supports the syntax for INSERT statement like
INSERT INTO Table_Name(Col1, COl2. Col3...)
SELECT Col1, COl2. Col3...
FROM Other_Table_Name
This will insert that result set returned by the select statement into target table. In your case the Result is a UNION of two selects therefore it is not any different from a single select.