BULK INSERT problem in MySQL

会有一股神秘感。 提交于 2019-12-31 03:06:31

问题


I get an error with the following SQL command for bulk insert.

    BULK INSERT libra.faculty
    FROM 'd\:faculty.csv'
    WITH
    (
        FIELDTERMINATOR = ',',
        ROWTERMINATOR = '\n'
    );

Here's the error message:

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near 'BULK
    INSERT libra.faculty
    FROM 'd:\faculty.csv'
    WITH
    (
    FIELDTERMINATOR = ',',
    RO' at line 1

回答1:


Use LOAD DATA INFILE instead of BULK INSERT




回答2:


LOAD DATA INFILE 'd:faculty.csv' INTO TABLE libra.faculty FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'



来源:https://stackoverflow.com/questions/2838828/bulk-insert-problem-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!