On Mon, 12 Jan 2004, Hassan Shaikh wrote: > Hi, > The following does not work for InnoDB tables. The manual says "The next > AUTO_INCREMENT value you want to set for your table (MyISAM). " > ALTER TABLE <table_name> AUTO_INCREMENT = <new_value>; > > Any suggestions for InnoDB?
Insert a row with a custom value, then delete it, the next value insrted will be value+1 of the value you juse inserted. Example below: [EMAIL PROTECTED]:tmp > CREATE TABLE ai (num INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARy KEY) TYPE=INNODB; Query OK, 0 rows affected (0.01 sec) [EMAIL PROTECTED]:tmp > INSERT INTO ai VALUES (NULL), (NULL), (NULL); Query OK, 3 rows affected (0.02 sec) Records: 3 Duplicates: 0 Warnings: 0 [EMAIL PROTECTED]:tmp > SELECT * FROM ai; +-----+ | num | +-----+ | 1 | | 2 | | 3 | +-----+ 3 rows in set (0.00 sec) [EMAIL PROTECTED]:tmp > INSERT INTO ai VALUES(10); Query OK, 1 row affected (0.00 sec) [EMAIL PROTECTED]:tmp > DELETE FROM ai WHERE num=10; Query OK, 1 row affected (0.01 sec) [EMAIL PROTECTED]:tmp > INSERT INTO ai VALUES(NULL); Query OK, 1 row affected (0.00 sec) [EMAIL PROTECTED]:tmp > SELECT * FROM ai; +-----+ | num | +-----+ | 1 | | 2 | | 3 | | 11 | +-----+ 4 rows in set (0.00 sec) [EMAIL PROTECTED]:tmp > \t -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]