Importing .csv file into sqlite3 db table
I wrote a single shell script to import a CSV file into a sqlite3 database table.
echo -e '.separator "," \n.import testing.csv aj_test' | sqlite3 ajtest.db
sqlite3 database = ajtest.db sqlite3 table in ajtest.db = new_test
test.csv has 3 columns, the first is int, the other two are texts; so accordingly the new_test structure is also -
sqlite> .schema aj_test
CREATE TABLE aj_test(number integer not null,
first_name varchar(20) not null,
last_name varchar(20) not null);
when the script is executed it doesn't show any errors, but it also doesn't import any data. Any advice as to what I missed?
+3
source to share