BULK INSERT in MYSQL

2019-01-06 16:17发布

问题:

On MS SQL, I can do bulk insert using the sql command below:

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.

回答1:

In MySQL, the equivalent would be

LOAD DATA INFILE

http://dev.mysql.com/doc/refman/5.1/en/load-data.html

LOAD DATA INFILE 'C:\MyTextFile'
INTO TABLE myDatabase.MyTable
FIELDS TERMINATED BY ','


标签: mysql insert