On Sun, 8 Sep 2013 22:56:20 +0000
"Joseph L. Casale" <jcas...@activenetwerx.com> wrote:

> 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.

If I understand the question, and there is no key other than the
auto-incrementing integer, there might not be a good way.  It sounds
like the database's design may have painted you into a corner.  

I think you want 

        insert into B
        insert into A with FK pointing to new rows in B

The way to do that is

        insert into B
        insert into A
                select ... from B 
                where natural key = key of new rows

The insert-select statement gives you the magic integer based on
something you do know: the natural key of the data.  

HTH.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to