7

我正在尝试将大型 .sql 文件导入 SQLite .db 文件,但出现以下错误:

sqlite> .read ./smsCorpus_en_2012.04.30.sql 
Error: near line 23: near "COMMENT": syntax error
Error: near line 50: near "LOCK": syntax error
Error: near line 52: near "some1": syntax error
Error: near line 58: near "s": syntax error
Error: near line 60: near "s": syntax error
Error: near line 66: near "UNLOCK": syntax error

该文件位于http://wing.comp.nus.edu.sg:8080/SMSCorpus/data/corpus/smsCorpus_en_sql_2012.04.30.zip(直接文件链接)链接在此页面http://wing.comp.nus .edu.sg:8080/SMSCorpus/history.jsp

编辑:只是一个警告,文件很大......不确定这是否是问题?

4

2 回答 2

10

该文件是 MySQL 转储。为了让 SQLite 理解它,你必须:

  • 删除COMMENT表字段上的 s;
  • 从(无论如何AUTO_INCREMENT,字段在 SQLite 中都是自动递增的);idINTEGER PRIMARY KEY
  • 删除ENGINEDEFAULT CHARSET;
  • 删除LOCK/UNLOCK命令;
  • 使INSERT命令的记录更少;
  • \'引用替换为''.
于 2012-10-16T18:14:07.633 回答
1

That is a MySQL Dump and not SQLite.

There are slight variations on the syntax.

于 2012-10-16T17:51:56.817 回答