> What is the most efficient way to insert several records into a table which > has a fk ref to the auto incrementing pk of another insert I need to do in the > same statement.
Without knowing too much about your application, I'd say that it's usually fine to just: 1. Do the INSERT 2. Get the last_insert_rowid() 3. Do your dependent INSERT with that ID. Usually the reason people want to combine steps #1 and #2 is that there is network latency in between or lock contention some other cost to separating them. But sqlite doesn't have that, your requests don't go over a network, it's all just in your process space. Is there another reason that you want to combine these steps?
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users