This does look like a solution indeed. I'll try this one later. Thank you! Mike
-----Ursprüngliche Nachricht----- Von: Simon Davies [mailto:[EMAIL PROTECTED] Gesendet: Montag, 29. Oktober 2007 16:40 An: sqlite-users@sqlite.org Betreff: Re: [sqlite] INSERT OR IGNORE and sqlite3_last_insert_rowid() On 29/10/2007, Odekirk, Shawn <[EMAIL PROTECTED]> wrote: > Adding "primary key" to column "a" results in the behavior I think you > were first expecting. > > sqlite> create table tmp (a integer primary key, b integer); > sqlite> create unique index tmpIndex on tmp (a, b); > sqlite> insert into tmp values (1, 1); > sqlite> insert into tmp values (2, 2); > sqlite> select last_insert_rowid(); > 2 > sqlite> insert or replace into tmp values (1, 1); > sqlite> select last_insert_rowid(); > 1 > sqlite> select * from tmp; > 1|1 > 2|2 > > I wonder if Michael could use OR REPLACE instead of OR IGNORE to solve > his problem. > > Shawn > That was the result I was seeking (as a potential answer to Michael's problem). Looking at Michael's original post, he has declared an INTEGER PRIMARY KEY column, so "OR REPLACE" instead of "OR IGNORE" could be the solution as you suggest. Rgds, Simon ---------------------------------------------------------------------------- - To unsubscribe, send email to [EMAIL PROTECTED] ---------------------------------------------------------------------------- - ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------