In one of my tables I have a primary key which is a int. It also is a unsigned int and is set to auto-increment.
If I add lets say 20 records and then delete those 20 records how can I stop or reset it so that it doesn't start the next record on 21? How can I get it to start back at 1?
questions about a priamry key
Here is the query to reset Auto Increment
Code: Select all
ALTER TABLE tbl_name AUTO_INCREMENT = 0
Re: questions about a priamry key
Is it possible to "reset" or "set" the auto-increment value inside Delphi code?
If so I need help in setting up that code, thanks,
If so I need help in setting up that code, thanks,
Re: questions about a priamry key
Here is a code example that demonstrates how to reset auto increment field:
Code: Select all
MyConnection.ExecSQL('ALTER TABLE tbl_name AUTO_INCREMENT = 0');
Re: questions about a priamry key
Feel free to contact us if you have any further questions.