|
|
Changing/Altering the Auto_increment value - Mysql
|
Views : 712
|
|
Tagged in : Mysql
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Some times we tend to test tables by inserting and deleting rows.
If we have an auto_increment column in the table then even after deleting the auto_increment value would continue to increase.
For example
if we had 5 rows and then deleted those 5.
After this if we tend to insert a new row the value of the auto_increment column would '6',but we would like to have '1'.
So if we want to start the value again from 1 , use the following query:
alter table <table_name> auto_increment=<value>;
ex:
alter table xx auto_increment=10;
After the execution of the above query the next insertion would have the value as '10'.
|
|
By - Vijay, On - 2008-03-14 |
|
|
|