default values do not set in MySQL database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
ruth
Forum Newbie
Posts: 19
Joined: Wed Aug 07, 2002 9:24 pm
Location: Melbourne, Australia

default values do not set in MySQL database

Post 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
jmarcv
Forum Contributor
Posts: 131
Joined: Tue Jul 29, 2003 7:17 pm
Location: Colorado

Post 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.
Post Reply