I've read a bit about using LAST_INSERT_ID(expr) to set the next auto_increment value.
my question is, if i have 2 tables, like follows CREATE TABLE A ( id int not null auto_increment primary key, ... )type=MyISAM; CREATE TABLE B ( id int not null auto_increment primary key, ... )type=MyISAM; and if SELECT max(id) FROM A returns 1000 and SELECT max(id) FROM B returns 3000 if i issue the query SELECT LAST_INSERT_ID(10000); then does my next insert into both A and B give A.id the value 10000 and B.id the value 10000 The Mysql Reference Manual ny O'Reilly Community Press (which is basically the on-line docs at mysql.com) in section 6.3 (page 500 on my copy) says the following: "If expr is given as an arguement to LAST_INSERT_ID(), the value of the arguement is returned by the function, is set as the next value to be returned by LAST_INSERT_ID(), and is used as the next AUTO_INCREMENT value...." What i want to do is, regardless of the current max(A.id), i want the next insert to give A.id the value 1000000 for instance. and give B.id the value 2000000 I know that i can explicitely set the value in the insert query, such as INSERT INTO A SET id=1000000, ..... INSERT INTO B SET id=2000000, ..... but, im doing a bulk load of 100000+ records (plus child records), and dont want the additional overhead in my perl script to say if this is the first record in the load, explicitely set the id field value, otherwise let mysql take care of it with the normal auto_increment functionality. another solution is to pre-emptively put a "dummy" record in each table, with the desired auto_increment field value, then delete those records at the end. but this is sloppy, and if the script bails, those records are left. thanks, sean peters [EMAIL PROTECTED] filter buster: mysql, 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