Mikey C <[EMAIL PROTECTED]> wrote: > Hi, > > Does last_insert_rowid() return the identity of the main insert or would it > return the id of a row inserted by a trigger if the main insert caused a 2nd > insert to occur on another table via a trigger? >
Both. If last_insert_rowid() is called from within the trigger that does the 2nd insert, then the rowid of the 2nd insert is returned. If last_insert_rowid() is called after the trigger has finished, the rowid of the last insert to occur before the trigger fired is returned. I have updated the documentation to try to make this clearer. -- D. Richard Hipp <[EMAIL PROTECTED]>