On 14 Oct 2016, at 2:29pm, Thom Wharton <twhar...@northpointdefense.com> wrote:
> I want to be able to programmatically insert a new record anywhere in that > table. Let's suppose I want to create a new record between the records whose > ID are 2 and 3. This new record would need to take the ID of 3, and all > subsequent records would need to have their primary keys updated. > > Is there a way to do this automagically (like a specialized INSERT command?) > in Sqlite? It's a silly thing to want to do since it makes a nonsense of what IDs are for. I think you need to rethink what you're trying to do by changing existing IDs. However, if you really need to do it ... UPDATE MyTable SET ID = ID + 1 WHERE ID >= 3; INSERT INTO MyTable ... Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users