![]() ![]() I've reproduced this problem using /usr/bin/sqlite3 3.7.13 in OS X 10.9.5 (as shown above) and version 3.7.3 in Debian 6. However, if I create the table first, then it "works", but I end up with an unwanted header row since it is case (2): sqlite> CREATE TABLE sometable (a, b, c) $ ( echo 'a,b,c' echo '1,2,3' ) > somedata.csvĮnter SQL statements terminated with a " " ![]() To avoid this, make sure that table does not previously exist. This command accepts a file name, and a table name. If the CSV file contains an initial row of column labels, that row will be read as data and inserted into the table. You can import data from a CSV file into an SQLite database. In other words, if the table does not previously exist, theįirst row of the CSV file is interpreted to be column names and theĪctual data starts on the second row of the CSV file.įor the second case, when the table already exists, every row of the CSV file, including the first row, is assumed to be actual content. Is automatically created and the content of the first row of the inputĬSV file is used to determine the name of all the columns in the In the first case, when the table does not previously exist, the table There are two cases to consider: (1) Table "tab1" does not previouslyĮxist and (2) table "tab1" does already exist. import c: /users/inspiron/desktop/people2012.csv people2012 The result of which is: c: /users/inspiron/desktop/pessoas2012.csv:11: expected 120 columns but found 1 - filling the rest with NULL However, when specifying the base, there is no value in the columns. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |