13

Since version 3.7.11 SQLite supports enhanced INSERT syntax to allow multiple rows to be inserted via the VALUES clause.

http://www.sqlite.org/releaselog/3_7_11.html

Is there any limit on how many values can be inserted in a single statement? (for e.g. 500)

shantanuo
  • 30,102
  • 75
  • 225
  • 364

2 Answers2

18

SQLite handles a multi-row INSERT like a compound SELECT. The limit for that is indeed 500.

However, since version 3.8.8,

the number of rows in a VALUES clause is no longer limited by SQLITE_LIMIT_COMPOUND_SELECT.

CL.
  • 165,803
  • 15
  • 203
  • 239
4

According to the official documentation, there are some limits actually:

  1. Maximum Length Of An SQL Statement

    The maximum number of bytes in the text of an SQL statement is limited to SQLITE_MAX_SQL_LENGTH which defaults to 1000000 bytes.

  2. Maximum Number Of Host Parameters In A Single SQL Statement

    The number of host parameters (aka tokens) - either named, unnamed or numbered - is limited to SQLITE_MAX_VARIABLE_NUMBER, which defaults to 999 items.

Mike Shiyan
  • 188
  • 1
  • 10