This link gives a little more information: http://www.sqlite.org/autoinc.html
Shawn -----Original Message----- From: Dennis Cote [mailto:[EMAIL PROTECTED] Sent: Monday, October 29, 2007 10:57 AM To: sqlite-users@sqlite.org Subject: Re: [sqlite] INSERT OR IGNORE and sqlite3_last_insert_rowid() Simon Davies wrote: > Following this thread, I was experimenting with last_insert_rowid(), > and found the following, which does not look right: > > SQLite version 3.4.2 > Enter ".help" for instructions > sqlite> > sqlite> create table tmp( a integer, 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> > sqlite> insert or replace into tmp values( 1, 1 ); > sqlite> select last_insert_rowid(); > 3 > <------ !!!???!!! > sqlite> select * from tmp; > 2|2 > 1|1 > sqlite> > > > > Simon, If you change your query to; select rowid, * from tmp; it will display the rowid which is different than either of the fields in the table. When doing a replace sqlite deletes the existing row and adds a new row. HTH Dennis Cote ------------------------------------------------------------------------ ----- To unsubscribe, send email to [EMAIL PROTECTED] ------------------------------------------------------------------------ ----- ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------