插入大量记录时出现 SQLite 问题 [英] SQLite Issue when inserting large number of records

查看:31
本文介绍了插入大量记录时出现 SQLite 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 SQLite3 shell 在某个表中插入 15530 条记录,但出现该错误,我搜索了 SQLITE_MAX_COMPOUND_SELECT 解决方案,默认为 500 是原因,但我不知道如何使用 Shell 更改它.

I am trying to insert 15530 record in a certain table using SQLite3 shell but i get that error , I searched for the solution SQLITE_MAX_COMPOUND_SELECT which defaults to 500 is the reason , but i don't know how to change it using Shell.

错误:复合 SELECT 中的术语过多"

"Error: too many terms in compound SELECT"

http://desmond.imageshack.us/Himg861/scaled.php?server=861&filename=sqlite.jpg&res=landing

INSERT INTO table_name (my_id, my_name) VALUES
(1, 'Aaliyah'),
(2, 'Alvar Aalto'),
(3, 'Willie Aames'),
...
(15530, 'name');

推荐答案

INSERT INTO 不能那样工作.

试试这个:

BEGIN TRANSACTION
INSERT INTO author (author_id, author_name) VALUES (1, 'Aaliyah')
INSERT INTO author (author_id, author_name) VALUES (2, 'Alvar Aalto')
INSERT INTO author (author_id, author_name) VALUES (3, 'Willie Aames')
...
END TRANSACTION

http://www.sqlite.org/lang_insert.html

这篇关于插入大量记录时出现 SQLite 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆