A simple example of UNION and UNION ALL with two table variables. UNION removes the duplicate rows, while UNION ALL keeps every row from both tables.
SQL SERVER – Three Rules to Use UNION
The three rules to use UNION from Ben Forta’s T-SQL book: two or more SELECT statements, the same columns in the same order, and compatible data types.
SQL SERVER – Insert Multiple Records Using One Insert Statement – Use of UNION ALL
Insert multiple records with one INSERT statement by combining SELECT and UNION ALL, instead of a separate INSERT for every row. SQL Server 2008 has a newer way.


