gregs

AUTO INCREMENT

by gregs on Jun.29, 2006, under MySQL

Since the MySQL Query Browser on my Mac refused to let me set a field as auto increment through the GUI, here's how you can using SQL change an existing column to use auto_increment:

SQL:
  1. ALTER TABLE `aggregatedWeekly` CHANGE `Id` `Id` INT( 6 ) UNSIGNED NOT NULL AUTO_INCREMENT

UPDATE

I have also recently found out that the following works just as well:

SQL:
  1. ALTER TABLE `aggregatedWeekly` AUTO_INCREMENT=1


Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!