Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2003
    Location
    Kuala Lumpur, Malaysia
    Posts
    5

    Unanswered: LOAD DATA INFILE problem...

    hihi...
    I'm trying to load a csv file into MySQL database. I tried using LOAD DATA INFILE but i managed only to load one row of record. While i very much would like all the records from the csv file to be inside my database table. Any idea what is wrong? I am under the impression that LOAD DATA INFILE will save all the record within a csv file into the table is use correctly.
    Below is my SQL statement:

    load data infile 'E:/030425_203_126_222_222.csv' into table voip_db.April2003 fields terminated by ',' lines terminated by '\n';

    Noelle

  2. #2
    Join Date
    Aug 2003
    Location
    FDR India
    Posts
    24
    AFAIK, on MS Windows lines are terminated by "\r\n".

    "\n" is the default for *nix OS-family. Try using the ESCAPED BY and ENCLOSED BY options too.

    If that doesn't work, try saving the file as TAB (\t) seperated and ENCLOSED BY ''. That is MySQL default and I'm hoping that would work for you.

    BTW, did LOAD DATA throw any errors in your log file?

    regards
    theN

  3. #3
    Join Date
    Jul 2003
    Location
    Kuala Lumpur, Malaysia
    Posts
    5
    hihi...
    I have tried the way you have specified but i am still having only one record within my table. I can't seems to be able to have al the records in my csv file to be save in my table.
    Noelle

  4. #4
    Join Date
    Aug 2003
    Location
    FDR India
    Posts
    24
    Try creating the CSV file again. My guess is that the file has something wrong with it.

    How did you create the CSV file?

    regards
    theN

  5. #5
    Join Date
    Jul 2003
    Location
    Kuala Lumpur, Malaysia
    Posts
    5
    The file is not created by me but by a device. All files created are the same. It will defeat the purpose of having this system if i'm going to alter the content of the file.
    Is there any other similar syntax that i can use that gives me the same result?
    Will be very greatful if you can help me out in this
    Noelle

  6. #6
    Join Date
    Jul 2003
    Location
    Kuala Lumpur, Malaysia
    Posts
    5
    hihi...
    Thanks then for your reply. I have figure out what is wrong with my syntax already. I should retain the original way of specifying the file instead of changing the extension to .csv
    Noelle

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •