I have table named A with column B defined int not null Primary Key
and there are 4-5 foreign keys that point to this column already. With what syntax of Alter
to make this primary key column be AUTO_INCREMENT ?
Asked
Active
Viewed 2,008 times
1

Dominating
- 2,890
- 7
- 25
- 39
-
1you asked just once faced task? http://stackoverflow.com/questions/2169080/mysql-alter-a-column-to-be-auto-increment – Sergey Vedernikov Feb 18 '11 at 09:17
3 Answers
1
Hi does something like this work?
alter table A B int NOT NULL AUTO_INCREMENT
I believe you should use something similar, if you use SQLYog to do it with the user interface then you see in the history tab the corresponding alter command generated.

Davide Piras
- 43,984
- 10
- 98
- 147
-
Ultor is right, see the proper solution in the question he has posted above. – Davide Piras Feb 18 '11 at 09:20
1
If its a primary column go to the table defination, there u can set the auto increment value in the column properties. go to the Column Properties ----> click on identity Specification -----> give the identity increment value and the identity seed value. then for every new row the value will be auto incremented.

Sai Kalyan Kumar Akshinthala
- 11,704
- 8
- 43
- 67