Insert Records using SELECT and UNION ALL Statements in SQL

We have different ways to insert data in table. In this blog you will learn how to insert data using SELECT and UNION ALL statements.
 
The following script helps to create the table. 
  1. Create table Mas_Employee(  
  2.    Id int primary key identity(1,1),  
  3.    Name varchar(50),  
  4.    Salary int ,  
  5.    DeptId int  
  6. )  
Insert data into table using SELECT and Union 
  1. insert into Mas_Employee ( Name, Salary, DeptId )   
  2. select 'Jaipal',18200,1     union all  
  3. select 'Jayanth',14200,2 union all  
  4. select 'Sreeshanth',12999,2 union all  
  5. select 'Tejaswini',16800,1  
I hope you enjoyed it. Please provide your valuable suggestions and feedback if you found this article helpful.
Ebook Download
View all
Learn
View all