Thanks Marc and all who responded. Marc's suggestion seems to come the closest to what I was looking for.
I did try one other thing which I thought might solve the problem. Instead of defining the Name/Sequence as UNIQUE, I set up a UNIQUE index for those columns and defined both of them to be sorted DESC. I then tried: UPDATE Test INDEXED BY TestIndex SET Sequence=Sequence+1 WHERE Name='Blue' AND Sequence>=3 I was surprised that I still got the error that Name/Sequence were not unique since I thought the index would force the updates to be done starting at the highest sequence number. EXPLAIN QUERY PLAN indicates that the TestIndex index was used. Pete On Fri, Sep 6, 2013 at 9:00 AM, <sqlite-users-requ...@sqlite.org> wrote: > Message: 27 > Date: Fri, 6 Sep 2013 07:50:39 -0500 > From: "Marc L. Allen" <mlal...@outsitenetworks.com> > To: General Discussion of SQLite Database <sqlite-users@sqlite.org> > Subject: Re: [sqlite] UPDATE question > Message-ID: > <e7544051a0971a48b80ab118ac58918e05fb7da...@mbx03.exg5.exghost.com > > > Content-Type: text/plain; charset="us-ascii" > > No one commented on my second thread (written after I actually understood > the problem!). > > But, I proposed a two update sequence to do it. > > UPDATE table SET Sequence = -(Sequence + 1) WHERE Sequence >= > seq_to_insert AND Name = name_to_insert > > UPDATE table SET Sequence = -Sequence WHERE Sequence < 0 AND Name = > name_to_insert > Pete lcSQL Software <http://www.lcsql.com> _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users