I am trying to import a .csv file content into a Maria DB table but I am finding some difficulties. I am working into a Linux Ubuntu environment.
I have the following situation. This is my Status 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)
And this is the content of the file that I am trying to import into the previous 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
I performed the following command into MariaDB console and I am obtaining the following error message:
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
A doubt is that my .csv file is generated by a Windows machine that maybe handling the newline in different way (but it seems strange to me).
What is wrong? What am I missing? How can I correctly import my .csv file?
You are missing INTO TABLE table
i.e. into which table the CSV-file should be inserted.