On 8/08/2009 2:02 AM, Simon Slavin wrote: > On 7 Aug 2009, at 4:21am, aerende wrote: > >> sqlite> .import myfile.csv mydatabasetable >> sqlite> .output mydatabasetable.sql > > When you look at the .sql file in a text editor, does it make sense ? > Does it look like legal SQL ? Does it have all the INSERT commands in ? > > I would probably try it differently: open the .csv file in a > spreadsheet program, and use calculations to convert each line into an > INSERT command. Then save that column of commands as a text file and > add the CREATE TABLE and other commands to it.
Good idea, but not a novel one; creating INSERT statements using Excel is rather prevalent in rapid-response "support" environments and provides many work opportunities for data remediaters. Example: a database where many rows were thrown up by this query: select account_num, price, qty, amount from a_table where price * qty != amount; Further investigation showed that a high proportion met one of the following criteria: (1) price = account_num (2) qty = account_num (3) amount = account_num (4) price * qty = account_num -- after allowing for rounding. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users