Inserting multiple rows using a single SQL query in SQL SERVER2005 using UNION ALL

CGN007
Posted by CGN007 under Sql Server category on | Points: 40 | Views : 2382
SQLSERVER2005

INSERT INTO  EmployeeMas (Firstname ,Lastname ,sal ,Department )
SELECT 'Raj','aaa',5000,'ERP'
UNION ALL
SELECT 'Ram','bbb',4000,'ERP'
UNION ALL
SELECT 'Sachin','ccc',5000,'MED'
UNION ALL
SELECT 'Rahul','ddd',8000,'MED'



Table creation Script

CREATE TABLE EmployeeMas

(Firstname varchar(10),

Lastname varchar(10),

sal float,

Department varchar(10)

)

Comments or Responses

Login to post response