Thank you for your response to my first post on this list. I really appreciate your time to answer my question.
I tried every thing I could think following the manual for LOAD DATA before I joined this list. I probably did not explain my problem clearly in my initial post. What I try to do is to import a csv data file into MySQL using "LOAD DATA INFILE ...". I would like to leave some fields blank in the csv file, and let MySQL to set default values to those fields in the database when loading the data. But every thing goes fine except the default values do not set. Although it was the first time for me to send the post on this list, I was sure that I did not follow other people's threads. I checked my original post again after read your response, and I did start with a new thread. However, I apologize if somehow I did make any mistake. Thanks Ruth ----- Original Message ----- From: "Roman Neuhauser" <[EMAIL PROTECTED]> To: "Ruth Zhai" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, June 24, 2003 7:50 PM Subject: Re: default value does not set using LOAD DATA INFILE ... > please don't piggyback on other people's threads. you can start your > own for free. > > # [EMAIL PROTECTED] / 2003-06-24 09:46:24 +1000: > > I am using LOAD DATA INFILE to import some data to MySQL. I would like to > > leave some fields blank and use the default value set in the tables. I have > > spent many hours trying to find the problem, but no luck so far. According > > to the manual, it should work. I am hoping some one on this list would help > > me. The following is sql query string I used: > > > > LOAD DATA LOCAL INFILE \' file \' REPLACE INTO TABLE table > > FIELDS TERMINATED BY \'terminator\' ENCLOSED BY \'\"\' > > I see no indication as to which columns should be skipped in your > statement. What did you actually try? > > the manual (http://www.mysql.com/doc/en/LOAD_DATA.html) says: > > LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt' > [REPLACE | IGNORE] > INTO TABLE tbl_name > [FIELDS > [TERMINATED BY '\t'] > [[OPTIONALLY] ENCLOSED BY ''] > [ESCAPED BY '\\' ] > ] > [LINES > [STARTING BY ''] > [TERMINATED BY '\n'] > ] > [IGNORE number LINES] > [(col_name,...)] > > that would translate into (provided you wanted to insert into first, > third, and fifth column in your table): > > LOAD DATA LOCAL INFILE 'file' > REPLACE > INTO TABLE table > FIELDS > TERMINATED BY 'terminator' > ENCLOSED BY '"' > (col1, col3, col5) > > -- > If you cc me or remove the list(s) completely I'll most likely ignore > your message. see http://www.eyrie.org./~eagle/faqs/questions.html > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]