Wednesday, February 1, 2012

SQl : Insert Multiple Rows in a single statement

This new feature enables the developer to insert multiple rows in a single SQL Statement.

Example:

--SQL Server 2005

INSERT dbo.EMPLOYEE(SALARY) VALUES (1000)

INSERT dbo.EMPLOYEE(SALARY) VALUES (2000)

INSERT dbo.EMPLOYEE(SALARY) VALUES (3000)

INSERT dbo.EMPLOYEE(SALARY) VALUES (4000)

--SQL Server 2008

INSERT dbo. EMPLOYEE(SALARY) VALUES (1000),(2000),(3000),(4000)

No comments: