在 MYSQL 中批量插入
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14330314/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
BULK INSERT in MYSQL
提问by Ruben_PH
On MS SQL, I can do bulk insert using the sql command below:
在 MS SQL 上,我可以使用下面的 sql 命令进行批量插入:
BULK INSERT myDatabase.MyTable FROM 'C:\MyTextFile.txt' WITH FIELDTERMINATOR = ','
Now I want to do the same on MySQL but I can't seem to figure out how this works and what query to use.
现在我想在 MySQL 上做同样的事情,但我似乎无法弄清楚它是如何工作的以及使用什么查询。
回答by Eric J.
In MySQL, the equivalent would be
在 MySQL 中,相当于
LOAD DATA INFILE
加载数据文件
http://dev.mysql.com/doc/refman/5.1/en/load-data.html
http://dev.mysql.com/doc/refman/5.1/en/load-data.html
LOAD DATA INFILE 'C:\MyTextFile'
INTO TABLE myDatabase.MyTable
FIELDS TERMINATED BY ','