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]

Reply via email to