Merging the Data of Two Tables in SQL Server

This blog defines the method of merging the data of two tables, in SQL Server.

CREATE TABLE #tbl_1 (sno INT IDENTITY(1,1),name NVARCHAR(100),id INT)
CREATE
TABLE #tbl_2 (sno INT IDENTITY(1,1),name NVARCHAR(100),id INT)
INSERT
INTO #tbl_1 VALUES ('kiran','9876')
INSERT
INTO #tbl_1 VALUES ('praveen','7654')
INSERT
INTO #tbl_2 VALUES ('raju','245')
INSERT
INTO #tbl_2 VALUES ('vamshi','386')
SELECT
ROW_NUMBER() OVER(ORDER BY id DESC) AS sno,*
FROM
(
SELECT
name,id FROM #tbl_1
UNION
ALL
SELECT
name,id FROM #tbl_2
)
temp
DROP
TABLE #tbl_1
DROP
TABLE #tbl_2