Tuesday, 30 October 2012

Insert multiple rows into a table

CREATE TABLE Sample1(UserId INT IDENTITY,UserName VARCHAR(8),Sales Decimal(6,2))
GO
INSERT INTO Sample1 (UserName, Sales)
 SELECT 'Ram', 100.00
UNION ALL
 SELECT 'Raheem ', 700.00
UNION ALL
 SELECT 'Robert', 400.00
UNION ALL
 SELECT 'Sachin', 800
 UNION ALL
 SELECT 'Pawan', 1000.00
 UNION ALL
 SELECT 'Mahesh',50.00

 Select * from sample1

No comments:

Post a Comment