mySQL加载数据本地infile不正确的数字格式
我有一个像这样格式化的 csv 文件,
sth, sth, "100,000,000", sth, "200,000"
sth, sth, "200,000,000", sth, "500,000"
当我使用
mysql> load data local infile "thefile.csv" into table mytable terminated by ',' enclosed by '"' lines terminater by '\r\n';
时,“100,000,000”、“500,000”等数字会被截断。
请帮我!
I have an csv file formated like this,
sth, sth, "100,000,000", sth, "200,000"
sth, sth, "200,000,000", sth, "500,000"
When I used
mysql> load data local infile "thefile.csv" into table mytable terminated by ',' enclosed by '"' lines terminater by '\r\n';
then the numbers such as "100,000,000", "500,000" are truncated.
Please help me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 CSV 文件中删除空格:
并尝试使用此语句加载数据 -
Remove spaces from the CSV-file:
And try to use this statement to load data -
在 php 中尝试这种方法:
参考: fgetcsv
try this approach in php:
reference: fgetcsv