Hi. I have a question regarding loading data from text files into tables using the LOAD DATA statement. I tried this under Win98 without success. Basically, I have a file called create.tbl which has CREATE TABLE statements. The last statements in this file are of the form:
LOAD DATA INFILE "file.dat" REPLACE INTO TABLE tbl_name; Then I ran, mysql <create.tbl at the DOS prompt. Although it gave no errors, the tables were filled with NULL values (other than the NOT NULL AUTO_INCREMENT fields). I tried this with just one simple table to start with - it is defined as: CREATE TABLE tbl_name (pid MEDIUMINT NOT NULL AUTO_INCREMENT, name VARCHAR(50), PRIMARY KEY (pid)); In the file.dat data file, I only put in 2 rows with one column (the name). I didn't put a column with numbers because it's defined as AUTO_INCREMENT, so I figure the DBMS will take care of creating it properly. The result is that I do have two pids (1 and 2) but the name field in the table is NULL. I tried putting the name values in the file.dat file without quotes and also with single and double quotes, but to no avail. I also put the data file in my current directory, in the data directory and in the database directory, but all gave the same result. In addition, everytime I ran mysql < create.tbl, the table kept growing - so, instead of only having 2 entries in it, I now have about 20 or so, where the first id field numbers from 1 to 20 and the other field is all null. Any ideas? Must I put a consecutive number field in the data file anyway as the first column? Thanks, Eurico --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php