* Son Nguyen > CREATE table test1 (ID int NOT NULL AUTO INCREMENT, name text, value > text, Primary Key (ID)); > > INSERT into test1 (name, value) values ("test1", "value1"); > > INSERT into test1 (name, value) values ("test2", "value2"); > > DELETE from test1 where ID=2; > > How can obtain the CURRENT value of next ID AUTO INCREMENT value > (which is 3 right now)
I don't know if you can, but you shouldn't want to try... :) Unless you have a single user application, the future value of any field can not be determined, unless you introduce locking and thereby a bottleneck. Use LAST_INSERT_ID() _after_ the insertion has been done. That is the easiest and safest way to get the correct key. -- Roger query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php