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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: