当我确定过去出于相同的目的使用过\ N值时,MySQL不接受\ N值。
步骤:
CREATE TABLE t (i INT NULL, name varchar(50));
创建一个名为test.txt
的文件,并用制表符分隔字段:
1 John
\N Jim
在MySQL中:
LOAD DATA INFILE '/var/lib/mysql-files/test.txt'
INTO TABLE t
Fields terminated BY "\t"
Escaped by ''
Lines terminated BY "\r\n";
错误:
ERROR 1366 (HY000): Incorrect integer value: '\N' for column 'i' at row 2
答案 0 :(得分:0)
我应该这样做:
LOAD DATA infile '/var/lib/mysql-files/test.txt'
INTO TABLE t
fields terminated BY "\t"
Escaped by '\\'
lines terminated BY "\r\n";