LOAD DATA LOCAL INFILE "E:\\\TEST.CSV" INTO TABLE `TEST`
.....
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';
此命令为一行,注意分号位置。另外注意使用前先用use命令选定表
1
|
FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' |
FIELDS行 TERMINATED 字段分隔符,ENCLOSED文字分隔符(包裹符),ESCAPED转义符(要写入FIELDS ESCAPED BY ‘\\’,您必须为待读取的值指定两个反斜杠,作为一个单反斜杠使用)
1
|
LINES TERMINATED BY '\n' STARTING BY '' |
LINES行 TERMINATED换行符,STARTING前缀符(包含此字符的数据行才会读取)
转载请注明:谷谷点程序 » mysql导入csv文件