为什么收到试图将.csv文件导入MariaDB表的错误消息?

问题描述 投票:0回答:1

我正在尝试将。csv文件内容导入到Maria DB表中,但是发现了一些困难。我正在研究Linux Ubuntu环境。

我有以下情况。这是我的Status表:

MariaDB [Delphys]> describe Status;
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| StatusID    | int(11)      | NO   | PRI | NULL    | auto_increment |
| Status      | char(1)      | YES  |     | NULL    |                |
| StatusGroup | char(3)      | YES  |     | NULL    |                |
| text        | varchar(255) | YES  |     | NULL    |                |
| TestText01  | varchar(255) | YES  |     | NULL    |                |
| TestText02  | varchar(255) | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.106 sec)

这是我要导入到上表中的文件的内容:

1;A;ABC;Existing sensors, already linked to DCS/DeltaV;Defalt value;Simulated input value
2;B;ABC;Existing sensors, already linked to DCS to be linked to DeltaV;Simulated value;Simulated input value
3;C;ABC;Sensors to be installed and linked to DCS/DeltaV;Simulated value;Simulated input value
4;D;D  ;Calculated Value without Model and GPA;expected result without Model and GPA;expected result without Model and GPA
5;E;E  ;Calculated Values after Establishment of Engine Model and GPA;expected result after Establishment of Engine Model and GPA;expected result after Establishment of Engine Model and GPA

我在MariaDB控制台中执行了以下命令,并获得以下错误消息:

MariaDB [Delphys]> LOAD DATA INFILE '/var/lib/mysql/Status.csv'
    -> INTO TABLE Status
    -> FIELDS TERMINATED BY ';' 
    -> LINES TERMINATED BY '\n'
    -> ;
ERROR 1366 (22007): Incorrect integer value: '??1' for column `Delphys`.`Status`.`StatusID` at row 1

怀疑我的。csv文件是由Windows计算机生成的,它可能以不同的方式处理换行符(但对我来说似乎很奇怪)。

怎么了?我想念什么?如何正确导入我的[[.csv文件?

mysql database mariadb rdbms csv-import
1个回答
0
投票
您缺少INTO TABLE table,即CSV文件应插入到哪个表中。
© www.soinside.com 2019 - 2024. All rights reserved.