LOAD DATA INFILE仅插入1条记录 [英] LOAD DATA INFILE only 1 record inserted

查看:68
本文介绍了LOAD DATA INFILE仅插入1条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要通过命令行导入的csv文件.但是仅插入了一行. 它们是逗号分隔的值.我在使用Excel Mac的Mac上.我另存为csv文件.如何判断行是否以\ r或\ n或两者终止?这是我使用的代码:

I have a csv file that I'm trying to import via the command line. But only 1 row is being inserted. They are comma separated values. I'm on a Mac using Excel Mac. I save as a csv file. How can I tell if the lines are terminated by \r or \n or both? Here is the code I used:

LOAD DATA LOCAL INFILE '/Users/eric/Documents/contacts_test.csv' INTO TABLE `contacts_tmp` FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\n' (clientid,contactid,title,fname,mname,lname,suffixname,salutation,occupation,employer,home_addr1,home_addr2,home_city,home_state,home_zip,home_county,primary_addr1,primary_addr2,primary_city,primary_state,primary_zip,primary_county,work_addr1,work_addr2,work_city,work_state,work_zip,work_county,email,phone_home,phone_mobile,phone_work,fax,phone_other,codes);

谢谢

推荐答案

遇到相同的问题,LINES TERMINATED BY '\r'完成了该工作.

Had the same issue, LINES TERMINATED BY '\r' did the job.

这篇关于LOAD DATA INFILE仅插入1条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆