Question no 2

Question no 2

In SQL Server 2008 R2, if I want to insert multiple rows in one statement, which format should I use?

1. INSERT dbo.mytable (col1, col2) VALUES (‘Test’, ‘Test2’), (‘Test3’, ‘Test4’), (‘test5’, ‘test6’);

2. INSERT dbo.mytable (col1, col2) SELECT (‘Test’, ‘Test2’), (‘Test3’, ‘Test4’), (‘test5’, ‘test6’);

3. INSERT dbo.mytable (col1, col2) VALUES ((‘Test’, ‘Test2’), (‘Test3’, ‘Test4’), (‘test5’, ‘test6’));

4. INSERT dbo.mytable (col1, col2) VALUES [(‘Test’, ‘Test2’), (‘Test3’, ‘Test4’), (‘test5’, ‘test6’)];

Go To The Answer

Advertisements