Thursday, 25 November 2010

MySQL Reset / Reseed Indentity Column

So, there I was refreshing all the data in a MySQL dev database and the TRUNCATE statement wasn't resetting the identity column. Bummer. Hey ho, was probably something to do with the table format. But I couldn't be arsed to mess about with that so used the ALTER TABLE statement to do it instead:

ALTER TABLE `my_table_name` AUTO_INCREMENT = 1;

I needed to set the identity back to 1, but use whatever number you need it to be set to.

No comments:

Post a Comment