On Mon, 9 Sep 2013 02:17:00 +0000
"Joseph L. Casale" <jcas...@activenetwerx.com> wrote:

> > 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.  
> 
> Well, after inserting one row into table A which looks like (without
> specifying the id and letting it auto generate):
> 
> CREATE TABLE table_a ( 
>     val    VARCHAR COLLATE "nocase" NOT NULL,
>     id INTEGER NOT NULL,
>     PRIMARY KEY ( id ) 
> );
> 
> I have for example 20 rows in table B to insert referencing the above:

Yes, that's what I suspected.  Because your table_a has no natural key,
you have no good way to select the auto-generated id value.  You can
find out what the last auto-generated value was, which lets you work a
row at a time,  but you're really suffering from a poor design choice.  

If you make val unique -- and I see no reason not to -- then you can
select the id for every val you insert with "where val = 'value' ". 

--jkl

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

Reply via email to