开发者

inserting data in mysql by text file

开发者 https://www.devze.com 2023-04-04 03:50 出处:网络
I have the following data in the text file LatLonCls -89.75-179.75EF -89.75-179.25EF -89.75-178.75EF -89.75-178.25EF

I have the following data in the text file

   Lat      Lon      Cls
   -89.75  -179.75   EF
   -89.75  -179.25   EF
   -89.75  -178.75   EF
   -89.75  -178.25   EF
   -89.75  -177开发者_运维百科.75   EF
   -89.75  -177.25   EF
   -89.75  -176.75   EF

and i have to insert in in the mysql database in the following table

CREATE TABLE IF NOT EXISTS `jos_lat_log` (
`Lat` text NOT NULL,
`Lon` varchar(255) NOT NULL,
`climatefamily` varchar(255) NOT NULL
);

i am using the following query to insert

LOAD DATA LOCAL INFILE 'C:\\Koeppen-Geiger-ASCII.txt' 
INTO TABLE `jos_lat_log` FIELDS TERMINATED BY '' LINES TERMINATED BY '\r\n';  

the above query is working but it is inserting data in only one column but i have to insert it in all three columes


if your fields are seperated by a space,

TERMINATED BY ' '

with a space between quotes


Your fields in the file are terminated by a space ' ', but you have listed '' in your query. Just change FIELDS TERMINATED BY '' to FIELDS TERMINATED BY ' '

0

精彩评论

暂无评论...
验证码 换一张
取 消