MySQL-csv insert into tables doesn't take effect

Markku Kolkka markkuk at tuubi.net
Wed Mar 16 11:43:46 UTC 2005


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 at iki.fi




More information about the users mailing list