Hi all; In my table tbphotos i had 100 recordes then i deleted all,now that i want restart data entry i see that my primary key doesn't start from 1 , but it start from 101 ,is there any way? -I work in "Mysql administrator"
thanks
Hi all; In my table tbphotos i had 100 recordes then i deleted all,now that i want restart data entry i see that my primary key doesn't start from 1 , but it start from 101 ,is there any way? -I work in "Mysql administrator"
thanks
You can reset the auto-increment like this:
ALTER TABLE tablename AUTO_INCREMENT = 1
But if you are relying on the autoincrement values, your program is very fragile. If you need to assign consecutive numbers to your records for your program to work you should create a separate column for that, and not use a database auto-increment ID for this purpose.
If you use TRUNC instead of manually deleting records, your primary key will be reset.