L le_toubib Active Member Licensed User Longtime User Sep 19, 2016 #1 hi all i m tryin to get last_id from an insert statement in JRDC2 can i use this mysql function : LAST_INSERT_ID() INSERT INTO foo (auto,text) VALUES(NULL,'text'); # generate ID by inserting NULL INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text'); # use ID in second table Click to expand... as batch commands ? is this possible / reliable ? is there a better way ? other than this http://stackoverflow.com/questions/13151861/fetch-last-inserted-id-form-stored-procedure-in-mysql which i dont really understand
hi all i m tryin to get last_id from an insert statement in JRDC2 can i use this mysql function : LAST_INSERT_ID() INSERT INTO foo (auto,text) VALUES(NULL,'text'); # generate ID by inserting NULL INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text'); # use ID in second table Click to expand... as batch commands ? is this possible / reliable ? is there a better way ? other than this http://stackoverflow.com/questions/13151861/fetch-last-inserted-id-form-stored-procedure-in-mysql which i dont really understand
Erel B4X founder Staff member Licensed User Longtime User Sep 20, 2016 #2 Yes. I just did some checking and you can safely use it as long as the second command with the LAST_INSERT_ID is sent together with the first one, in the same batch. Upvote 0
Yes. I just did some checking and you can safely use it as long as the second command with the LAST_INSERT_ID is sent together with the first one, in the same batch.