Hi,
I need to insert information from one table into another table. Both tables are identical in structure, indexes, etc. However, in the destination table (lz_chat_archive_dup2), there is one primary key column where the values have to be different.
Because of this, I have emptied all values in the source table (lz_chat_archive_dup1) for this column, and inserted all values from this modified table into a csv file. I also modified that column in the destination table to be auto_increment.
These are the steps to modify both tables :
CREATE TABLE lz_chat_archive_dup2 LIKE lz_chat_archive;
ALTER TABLE lz_chat_archive_dup2
MODIFY chat_id
int UNSIGNED AUTO_INCREMENT;
ALTER TABLE lz_chat_archive_dup2 AUTO_INCREMENT=383933;
LOAD DATA INFILE ‘/usr/local/LivezillaDB/mysql/lz_chat_archivedup1.csv’ INTO TABLE lz_chat_archive_dup2 FIELDS TERMINATED BY ‘,’;
However, I am not sure if what I am doing is correct, as when I run the LOAD statement to insert data into the 2nd table, I get error :
mysql> LOAD DATA INFILE ‘/usr/local/LivezillaDB/mysql/lz_chat_archivedup1.csv’ INTO TABLE lz_chat_archive_dup2 FIELDS TERMINATED BY ‘,’;
ERROR 1366 (HY000): Incorrect integer value: ‘’ for column ‘chat_id’ at row 1
mysql>
Do I have to insert the first value into the 2nd table manually before able to auto-increment the rest of the values with the csv file? Else what is the correct solution for this error?
All I need is to populate the new table with new information in the primay key column chat_id, starting with the value 383933. Please help, as I am not able to get this information in the internet.