Are you aware of the fact that your csv file describes a table containting three columns (name a, b, and c) whereas your SQL describes a single column named a,b,c with embedded commas in the values too?
Also please note that a temp table is disposed of when the connection is closed. So what you are seeing is an empty temp table shadowing a main table of the same name. Try to avoid giving tables in different databases the same names. The exact same statement will mean different things depending on the order of attaching the databases unless all names are qualified. -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Luuk Gesendet: Samstag, 09. März 2019 10:32 An: sqlite-users@mailinglists.sqlite.org Betreff: [EXTERNAL] [sqlite] where did my data go ? Re: Import data into a temporary table On 7-3-2019 22:45, Eric Tsau wrote: > Hi, > Is it possible to add the option of importing data into a temporary table? > Currently you have to create a temporary table first before importing > to it, or having to drop the table afterwards. > .import dump.csv temp.table > or > .import dump.csv attach.table > > Regards > Eric > C:\TEMP>del test.sqlite C:\TEMP>type abc.csv a,b,c 1,2,3 4,5,6 7,8,9 C:\TEMP>sqlite3 test.sqlite SQLite version 3.27.1 2019-02-08 13:17:39 Enter ".help" for usage hints. sqlite> .import abc.csv test sqlite> .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE test( "a,b,c" TEXT ); INSERT INTO test VALUES('1,2,3'); INSERT INTO test VALUES('4,5,6'); INSERT INTO test VALUES('7,8,9'); COMMIT; sqlite> sqlite> .import abc.csv temp.test Error: no such table: temp.test sqlite> .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE test( "a,b,c" TEXT ); COMMIT; sqlite> .quit Where did my data go (see above)? Luckily it's there when i restart sqlite3.exe: C:\TEMP>sqlite3 test.sqlite SQLite version 3.27.1 2019-02-08 13:17:39 Enter ".help" for usage hints. sqlite> select * from test; 1,2,3 4,5,6 7,8,9 sqlite> .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE test( "a,b,c" TEXT ); INSERT INTO test VALUES('1,2,3'); INSERT INTO test VALUES('4,5,6'); INSERT INTO test VALUES('7,8,9'); COMMIT; sqlite> _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0 May be privileged. May be confidential. Please delete if not the addressee. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users