Page 1 of 1

using AUTO_INCREMENT with LOAD DATA INFILE

Posted: Sat May 29, 2004 1:37 pm
by davidklonski
Hello

I am using LOAD DATA INFILE to load data into a table.
This is how the table is defined:
CREATE TABLE people (
ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Address VARCHAR(255) NOT NULL,
PRIMARY KEY (ID)
) ENGINE=MYISAM DEFAULT CHARSET=latin1;

I have 2 questions:
1) What value should be written in the file to represent a placeholder for the ID (it is an AUTO_INCREMENT attribute)?
2) Do I need to enclose strings (Name & Address attributes) with quotes?

thanks

Posted: Sun May 30, 2004 4:44 pm
by JAM
1) Try '' ( thats two ' )
2) You should. Take a peek on: http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html and " FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\'' " to meantion some goodies. It's wise to use.