469,277 Members | 1,959 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,277 developers. It's quick & easy.

Resetting AUTO_INCREMENT after deleting records

I add a column named deptid in my dept table which is auto incremented.
After adding 3 records I deleted those records and inserted another record.
But it take the deptid as 4. I want it to start from 1.
If U know how to do this pls help.

Best Regards
Aug 30 '07 #1
3 1558
code green
1,726 Expert 1GB
After adding 3 records I deleted those records and inserted another record.
But it take the deptid as 4. I want it to start from 1.
OK but why? This is what auto-number does.
If you want to define the id yourself, don't use auto-number.
Aug 30 '07 #2
r035198x
13,262 8TB
I add a column named deptid in my dept table which is auto incremented.
After adding 3 records I deleted those records and inserted another record.
But it take the deptid as 4. I want it to start from 1.
If U know how to do this pls help.

Best Regards
See the post #2 by Atli in this thread.
Aug 30 '07 #3
pbmods
5,821 Expert 4TB
Note that MySQL doesn't care whether the ID of the first record is 1, 6 or 548633. Forcing MySQL to reset the AUTO_INCREMENT value of a table will not improve performance.
Aug 30 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Pjotr Wedersteers | last post: by
reply views Thread by Miguel Perez | last post: by
9 posts views Thread by Bart Van der Donck | last post: by
5 posts views Thread by rameshkumarc | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.