开发者

Error encountered when importing data from csv file into sqlite table

开发者 https://www.devze.com 2023-01-31 22:07 出处:网络
I export the data 开发者_如何转开发from Excel 2011. The rows look like: 100|Agricultural Production-Crops|Agriculture&Forestry

I export the data 开发者_如何转开发from Excel 2011. The rows look like:

100|Agricultural Production-Crops|Agriculture&Forestry

I create the table in SQLite using: create table sic (id integer, industry text, category text); Then I input:

.mode csv sic

then:

.separator ","

then:

.import SIC.csv sic;

And I got the error: "Error: no such table: sic;" Why? What can I do?


The last parameter is the table name and should be sic in your case:

.import SIC sic;

The first parameter is the filename and should usually end in ".csv" or ".txt" for example (but it doesn't have to). You may want to double check that your filename is correct.

See the documentation:

.import FILE TABLE - Import data from FILE into TABLE


I find out from here: http://old.nabble.com/Import-CSV-in-sqlite3--td564241.html.

Exit SQlite 3. And key in:

sqlite3 -separator ',' test.db ".import sic.csv sic"

This solve the problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消