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 ?
-
1you asked just once faced task? stackoverflow.com/questions/2169080/…Sergey Vedernikov– Sergey Vedernikov2011-02-18 09:17:44 +00:00Commented Feb 18, 2011 at 9:17
Add a comment
|
3 Answers
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.
1 Comment
Davide Piras
Ultor is right, see the proper solution in the question he has posted above.
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.