0

I am creating a Mobile APP in Flex/Adobe AIR. I am using SQLite to store and retrieve data. I have a situation where I need to INSERT an unknown number of rows into a table. Is there a way to do this with a single statement in SQLite? I know that it can be done using a loop in AS3, but wanted to see if it's possible with a single SQL statement. I have found references to using UNIONS and SELECT, however, the examples weren't completely clear nor was I sure that they were applicable to my situation. Any examples are certainly appreciated.

Thanks.

azsl1326
  • 1,400
  • 2
  • 12
  • 22

1 Answers1

1

You should be able to do something like:

INSERT INTO SomeTable 
VALUES
('Column 1 Row 1', 'Column 2 Row 1'),
('Column 1 Row 2', 'Column 2 Row 2'),
('Column 1 Row 3', 'Column 2 Row 3');

You'll still need to loop in AS to build the SQL statement, though.

Note that there seems to be some confusion as to whether this syntax is supported by SQLLite.

Community
  • 1
  • 1
Amy Blankenship
  • 5,988
  • 1
  • 17
  • 41
  • Thanks. Yes, it seems that the SQL syntax in your response will not work in SQLite. However, the link you referenced seems to resolve the issue. – azsl1326 Jun 05 '12 at 05:20