Re: MySQL-csv insert into tables doesn't take effect

From: Markku Kolkka (markkuk_at_tuubi.net)
Date: 03/16/05

  • Next message: Mark Weaver: "Re: httpd trouble"
    To: fedora-list@redhat.com
    Date: Wed, 16 Mar 2005 13:43:46 +0200
    
    

    M E Fieu kirjoitti viestissään (lähetysaika keskiviikko, 16.
    maaliskuuta 2005 09:26):
    > Hi.. I create a data.csv file using excel file and
    > convert to CSV as following
    (...)
    > but when i tried to load the CSV file into the table
    > department, the name and job column still shown as
    > NULL? Why?? Any soiution?
    >
    > mysql>load data local infile '/root/data.csv' into
    > table department;

    LOAD DATA expects by default that fields are separated by tabs,
    not commas. You must specify that a comma is used as a
    delimiter:

    LOAD DATA LOCAL INFILE '/root/data.csv' INTO TABLE department
    FIELDS TERMINATED BY ',';

    http://dev.mysql.com/doc/mysql/en/load-data.html

    -- 
     Markku Kolkka
     markku.kolkka@iki.fi
    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    

  • Next message: Mark Weaver: "Re: httpd trouble"

    Relevant Pages

    • Saving Excel as a CSV
      ... I have an excel file with 63 columns and 3000+ rows. ... to be csv files. ... The table in sql has 74 columns to which i am trying to insert this ... But its not putting commas ...
      (microsoft.public.excel.misc)
    • Can somebody help me with this! Please!!!
      ... I have an excel file with 63 columns and 3000+ rows. ... to be csv files. ... The table in sql has 74 columns to which i am trying to insert this ... But its not putting commas ...
      (microsoft.public.excel.misc)
    • Going from column to comma separated list...
      ... The excel file starts out as a CSV that was created using a text editor ... already in the format I want with the commas between the names... ... the comma separated format I need. ...
      (microsoft.public.excel.misc)
    • Re: [PHP] Not quite OT but maybe close... Help with MySQL
      ... Does anyone know how to successfully import a excel file into MySQL Using PHP? ... I have tried using LOAD FILE in mysql and it just imports the first row of my excel file with no errors... ... Export to CSV, use the MySQL CSV storage engine to read file & transfer to a table in another storage engine: ... I would try reposting the question to the MySQL list with a more detailed description than 'it just imports the first row of my file' - as in, what does your LOAD DATA statement look like? ...
      (php.general)
    • Save file with fields within quotes and comma separated
      ... I want to save a CSV or another option in MS Excel file ... where all fields are separated by commas and all fields ... are within quotes. ...
      (microsoft.public.excel.programming)

    Loading