September 28th, 1999, 04:26 PM
I am sure mySQL allows this method. Could you guide me how I can update/insert into a table mySQL using a text file. My text format is using "delimiter", just like it is used in .htpasswd file from Apache.
My file is stored under my home directory (/home/www/test.dat)
September 29th, 1999, 05:02 PM
Check out the "LOAD DATA" command.
You might use something like:
load data infile '/home/www/test.dat' into table <mytable> fields terminated by '<delimiter>';
October 5th, 1999, 02:08 PM
I found something very similar to work, but had to include LOCAL in the SQL statement if the file was not directly on the MySQL server. My text file was tab delimited so I apparently did not need to specify the delimiter. SQL I used was like:
LOAD DATA LOCAL INFILE '/home/www/textfile.txt' INTO TABLE tablename