If you insert null into the main table as the value for recordNo (instead of the value from the temp table) when you transfer, you'll get a new recordNo value from main. Of course, that means you'll have to change "select * from temp" in your insert stmt to a select that explicitly names each column (insert into main select null, col1, col2... from temp;) -Clark
----- Original Message ---- From: R S <[EMAIL PROTECTED]> To: [email protected] Sent: Saturday, October 08, 2005 15:24:28 Subject: [sqlite] Qn on moving data from Temp Table to Main Table Hi, The Temp Table (obviously) mimics the Main Table. The Main Table has a column, recordNo which is a integer primary key (which autoincrements). Now I periodically move Data from the Temp into the Main Table (and then delete records from the Temp Table). It succeeds the first time, but fails subsequently because of duplicate recordNo values (I presume). Do I have to maintain the last recordNo value in the Main Table and pass it to the Temp Table so that it starts using those values during insertion to avoid a clash? Is there a better way of working around this problem? Thanks!

