0
我有Term.txt文件:分隔LOAD DATA LOCAL INFILE不加載正確
1 A
2 B
3 C
選項卡(\ t)。
我有表期限:
MariaDB [TermDS]> describe Term;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(35) | YES | | NULL | |
+-------+-------------+------+-----+---------+----------------+
我想這個文件加載到表:
MariaDB [TermDS]> LOAD DATA LOCAL INFILE '/home/abigail/Term.txt' INTO TABLE Term FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n';
Query OK, 1 row affected (0.03 sec)
Records: 1 Deleted: 0 Skipped: 0 Warnings: 0
結果是不正確的,因爲:
MariaDB [TermDS]> select * from Term;
+----+------+
| id | name |
+----+------+
| 1 | A
2 |
+----+------+
1 row in set (0.00 sec)
的麻煩的是,它不會發出任何錯誤或警告消息。爲什麼不加載成功?
您的字段沒有用'''括起來' – mitkosoft
我刪除了「ENCLOSED BY」部分,但得到了相同的結果。 – ling