MySQL Forums
Forum List  »  Data Recovery

Modify column to auto_increment
Posted by: Aigini Navaneethan
Date: August 14, 2020 11:47PM

Hi,

I want to modify an existing table column to auto-increment, and I have tried these but I get error :

mysql> ALTER TABLE lz_chat_archive_dup2 MODIFY COLUMN chat_id INT(10) AUTO_INCREMENT;
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

mysql> ALTER TABLE lz_chat_archive_dup2 MODIFY COLUMN chat_id INT(10) AUTO_INCREMENT KEY;
ERROR 1265 (01000): Data truncated for column 'chat_id' at row 12

How do I resolve this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Modify column to auto_increment
192
August 14, 2020 11:47PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.