sqlite3Explorer does that

________________________________

From: John Stanton [mailto:[EMAIL PROTECTED]
Sent: Wed 07-Dec-05 8:00 AM
To: [email protected]
Subject: Re: [sqlite] how can I import CSV file into SQLite quickly



Someone somwhere must have a simple Perl script which does what you want.
JS

Robert L Cochran wrote:
> I create an SQL file that has contents like this:
>
> [EMAIL PROTECTED] elections]$ cat insert_precinct.sql
> BEGIN TRANSACTION;
> INSERT INTO "precinct" VALUES(1, 'Community Center 15 Crescent Road', 3,
> 'Greenbelt', 'Maryland', 0);
> INSERT INTO "precinct" VALUES(2, 'Police Station 550 Crescent Road', 6,
> 'Greenbelt', 'Maryland', 0);
> INSERT INTO "precinct" VALUES(3, 'Springhill Lake Recreation Center 6111
> Cherrywood Lane', 8, 'Greenbelt', 'Maryland', 0);
> COMMIT;
>
> Then I fire up sqlite3 on the command line, and issue
>
> .read insert_precinct.sql
>
> I realize this will probably make you unhappy because it means editing
> your CSV file so that each line is transformed into an sql statement.
> This can be done most easily with sed (if you are a Linux or Unix
> person), but you need to know sed commands and you need to be willing to
> patiently experiment until the sed script applies exactly the right edits.
> Bob Cochran
>
>
> ronggui wong wrote:
>
>> I have a very large CSV file with 10000 rows and 100 columns.and the
>> file looks like the following:
>> "a","b","c","d",
>> "1","2","1","3" ,
>> "3","2","2","1",
>> ......
>>
>> If I use .import,It seems I have to set the variable names manually .
>> Is there any way to import the whole data file into SQLite quickly?
>> Thank you!
>>
>> ronggui
>>
>>
>> 
>>
>




Reply via email to