New INSERT syntax in SQL Server 2008
Posted by: mrdenny
One of the very cool new feature which SQL Server 2008 gives us is an change to the INSERT statement. Now you can specify multiple rows to insert into a table from a single insert command.
The syntax is:
CREATE TABLE TableName (Column1 INT, Column2 VARCHAR(10))
INSERT INTO TableName
(Column1, Column2)
VALUES
(1, ‘test1′), (2, ‘test2′), (3, ‘test4′)
I see this as being a very handy especially when doing an initial data load into a table as you can now load lots of data without having to run a lot of seperate insert statements.
Denny



You must be logged-in to post a comment. Log-in/Register