On Thu Jul 10, 2014 at 01:52:00PM +0100, Tim Streater wrote: > > What I'm actually doing is moving/copying a row from one database to > another, where the two databases have identical schemas. > ... > > So there are two copy steps. What I'd like to do is: > > ... > > but unfortunately there could easily be a conflict in the absid > values, so I have to be able to set it to null to get a new value > generated.
You were almost there. You can do it in one go if you specify the columns exactly: INSERT INTO dst.messages( col1, col2, col3 ) SELECT col1, col2, col3 FROM main.messages WHERE absid = some_value ; And then retrieve the last rowid: SELECT last_insert_rowid(); Mark. -- Mark Lawrence _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users