简体   繁体   中英

Importing .sql file into SQLite

I'm trying to import a large .sql file into an SQLite .db file, but I'm getting the following errors:

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

The file is located at http://wing.comp.nus.edu.sg:8080/SMSCorpus/data/corpus/smsCorpus_en_sql_2012.04.30.zip (direct file link) linked on this page http://wing.comp.nus.edu.sg:8080/SMSCorpus/history.jsp

EDIT: just a warning, the file is quite large...not sure if this is the issue?

That file is a MySQL dump. To make SQLite understand it, you have to:

  • delete COMMENT s on the table fields;
  • remove AUTO_INCREMENT from id ( INTEGER PRIMARY KEY fields are autoincrementing in SQLite anyway);
  • remove ENGINE and DEFAULT CHARSET ;
  • remove LOCK / UNLOCK commands;
  • make the INSERT commands have fewer records;
  • replace \\' quoting with '' .

That is a MySQL Dump and not SQLite.

There are slight variations on the syntax.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM