views:

687

answers:

3

Is it possible to insert multiple sets of values to a SQLite table in one statement?

I was trying:

INSERT INTO the_table VALUES (1,2,'hi'),(2,0,'foo');

with the different ()s representing different insert sets, but I get an error.

+1  A: 

You can do

INSERT INTO the_table 
SELECT 1,2,'hi'
UNION
SELECT 2,0,'foo';
ck
A: 

I was found that syntax in MSDN but after trying I can't do that too, than I note that in the bottom of the page was written that there is an error in the page :) where is link http://msdn.microsoft.com/en-us/library/ms174335.aspx see the bottom How to insert multiple rows

ArsenMkrt
A: 

Are there only three columns in your table? If not, you could try defining the column names you are setting like so:

INSERT INTO the_table (column1, column2, column3) VALUES (1,2,'hi'),(2,0,'foo')
Kazar