Page 1 of 1

default values do not set in MySQL database

Posted: Wed Jun 25, 2003 2:03 am
by ruth
Hi Everyone,
I am using LOAD DATA INFILE to import a csv data file to MySQL. I would like to leave some fields blank in the csv file in order to save users' typying, and let MySQL to set the default values to those fields when loading the data. Now, every thing is OK except the default values do not set after loading the data. Those fields remain blank.

According to MySQL's manual, it should work. I have tried every thing I could think following the manual, but still can not find the problem. I am hoping some one here could help me. The following is sql query string I used:

Code: Select all

LOAD DATA LOCAL INFILE '' file '' REPLACE INTO TABLE table
FIELDS TERMINATED BY ''terminator'' ENCLOSED BY ''"''
I also tried to use PHPMyAdmin to load the csv file. I have the same problem. Do I need to configure any thing in order to set the defaults automatically.

Your help is highly appreciated.

Thanks in advance.

Ruth

Posted: Tue Jul 29, 2003 9:20 pm
by jmarcv
Make sure your table is set to provide defaults, and make sure you are not using spaces in your data. Table dump and sample lines from your file would be helpful.