On 3/2/2011 9:48 AM, Ashley Sheridan wrote: > "Jim Lucas" <lists@xxxxxxxxx> wrote: > >> On 3/2/2011 4:25 AM, Alex wrote: >>> You shouldn't have a default value in an auto increment field. You >> can >>> set AUTO_INCREMENT to 0 and start with 1, but as auto increment is a >>> unique field and its automagically incremented, you should not set a >>> default value on it... >> >> This is fine and dandy until you want to do a restore of your data. >> >> With a restore, you will probably want to retain your auto-increment >> IDs since >> they are probably used else where in your DB. >> >> Jim >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php > > > Restoring data wouldn't need default values though, would it. You can just perform a regular insert statement and update the next id value to be used if necessary. > > Also, I'm not 100% sure on this one, but I thought that some versions of Mysql had problems with a 0 in an auto_inc field? > > > Thanks > Ash Ash, Sorry, I didn't mean to imply that the AUTO_INCREMENT set to 0 is fine. Doing an export of the table structure for one of my smaller tables (that is empty), I see that the AUTO_INCREMENT value is set to 1 by default. CREATE TABLE IF NOT EXISTS `ajax_products` ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `version` tinytext NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; It doesn't show a default value, but rather a default starting point for the AUTO_INCREMENT OP: Show us an export of your db table structure. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php