----- Original Message -----
From: "Diane Schips"
Subject: [wdvltalk] Huge file problem
> I have .csv file that I need to import into a database. I can use either
> Access or SQL. The problem, is the .csv file is 3 gigs...
> ...Any ideas on how I can get to the data in the file?
Easy answer: since you can open the csv file in your editor, edit it into
smaller chunks and import them one at a time?
More fun for programmers answer:
In any cgi language - ASP, php, Perl - you can open a file for read access
then read it line by line irrespective of how big the file might be.
In php there is a 'fgetcsv()' function that reads one line from a csv file
and puts it into an array:
$rec = fgetcsv($file);
$query = "INSERT INTO table (name, age, sex) " .
"VALUES ('$rec[0]', '$rec[1]', '$rec[2]')";
In ASP you'd have to write a bit more code to separate the line at the comma
separator. But basically it should be quite simple to write a one-shot
script that opens the csv file, reads to end of file and inserts the data
from each line into a db.
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.