我使用以下命令将excel文件加载到MySQL服务器:
LOAD DATA LOCAL INFILE 'GPMO_Resource_Download_report_CSV'
INTO TABLE gpmo_resource_download_report_1
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
我在以下路径的同一台机器上有这个文件:
C:\Users\aprakas2\Desktop\Task\GPMO_Resource_Download_report_CSV
请建议我如何加载此文件?
答案 0 :(得分:0)
我认为这些SQL对你有用。
如果文件有标题行
LOAD DATA INFILE 'C:/Users/aprakas2/Desktop/Task/GPMO_Resource_Download_report_CSV'
INTO TABLE gpmo_resource_download_report_1
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;
如果文件没有标题行
LOAD DATA INFILE 'C:/Users/aprakas2/Desktop/Task/GPMO_Resource_Download_report_CSV'
INTO TABLE gpmo_resource_download_report_1
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
谢谢。