为什么我在尝试将 .csv 文件导入 MariaDB table 时收到此错误消息?
Why am I obtaining this error message trying to import a .csv file into a MariaDB table?
我正在尝试将 .csv 文件内容导入 Maria DB table 但我发现了一些困难.我正在 Linux Ubuntu 环境中工作。
我有以下情况。这是我的 状态 table:
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)
这是我要导入到之前的文件中的内容 table:
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 文件?
您缺少 INTO TABLE table
即 table 应该插入 CSV 文件。
我正在尝试将 .csv 文件内容导入 Maria DB table 但我发现了一些困难.我正在 Linux Ubuntu 环境中工作。
我有以下情况。这是我的 状态 table:
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)
这是我要导入到之前的文件中的内容 table:
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 文件?
您缺少 INTO TABLE table
即 table 应该插入 CSV 文件。