Debt Consolidation - Krakow poland hotels - Jigsaw Puzzles - Debt Consolidation - Wordpress Theme

PDA

View Full Version : problem with 'load data infile', please help


simkeechai
Mar 29th 2006, 5:49 pm
hi there,

i am having problem loading data into my table.

here's my table 'mailing_list':
id int auto_increment primary key
email varchar(50)
email_source varchar(150)
country_id int(3)

sample data (seperated by tab):
xxx1@hotmail.com www.domain1.com 1
xxx2@gmail.com www.domain2.com 1
xxx3@blah.com www.domain3.com 1
xxx4@dude.com www.domain4.com 1
xxx5@kkk.com www.domain4.com 1

i would like to know the correct syntax to load this kind of data into mailing_list, fields email, email_source, and country only; and when i load these data, the id will increase automatically.

i tried to use the following syntax in query browser, but i got an error saying that there's error near line three:-

load data infile 'file location'
into table mailing_list
fields terminated by ''
lines terminated by '';

in addition, what if the data file is csv file, how do i load data into the table?

i appreciate your help. thank you in advance!

sacx13
Mar 29th 2006, 11:19 pm
load data infile 'file location'
into table mailing_list
fields terminated by ''
lines terminated by '';


Syntax is corect, try to remove lines terminated by or to set it to '\r\n' or '\n' (if unix) if still not working post the error on forum !

If is a csv file you need to change fields terminated by '' with ','

Regards
Adrian