15

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
  • 31,689
  • 78
  • 245
  • 403

2 Answers2

21

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.
  • 173,858
  • 17
  • 217
  • 259
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
  • 186
  • 2
  • 11