mysql - Data truncated when trying to import CSV file -
hi here load statement:
load data local infile 'c:/geoipcountrywhois.csv' table geolocation fields terminated ',' enclosed '"' lines terminated '\n'; 30 row(s) affected, 1 warning(s): 1265 data truncated column 'cn' @ row 30 records: 30 deleted: 0 skipped: 0 warnings: 1 create table `geolocation` ( `start_ip` char(15) not null, `end_ip` char(15) not null, `start` int(10) unsigned not null, `end` int(10) unsigned not null, `cc` char(2) not null, `cn` varchar(50) not null ) engine=myisam default charset=utf8
i found problem line below because of comma in korea things new field starts.
1.11.0.0,1.11.255.255,17498112,17563647,kr,"korea, republic of"
i can remove commas can change load statement somehow?
you should use optionally enclosed by
instead of enclosed by
.
http://dev.mysql.com/doc/refman/5.1/en/load-data.html
adding optionally statement allows csv in current form. without optionally keyword, expected every value have quotations around it.
Comments
Post a Comment