On 2014/06/25 21:38, Dave Wellman wrote:
Hi Petite,
Many thanks fo rthsuggestion, it works a treat!.

Hi Simon,
Thanks for the thoughts but in this particular processing that is not going
to happen (delete a few rows). In this processing we always empty the table
completely before re-populating it.

I've gone with the TRIGGEr solution, it works really well.


Hi Dave, as a side note - if you never remove rows, AND in stead of emptying the table (Truncation) you actually DROP and Re-CREATE it... then a standard AUTOINCREMENT rowid alias is almost guaranteed to actually produce you sequential numbering from 1 onwards. It really only starts doing funnies when you remove rows - but if you don't break the chain, the rowid won't either. I know the documentation does not "guarantee" it simply because the behaviour can go haywire after amendments to the table, but I have yet to see a rowid NOT start at 1 in a brand-new table, or indeed just randomly "miss a beat" as you add rows. never happens - until that first row is deleted.

Sometimes however one doesn't intend to delete things, but it happens, so I think the trigger solution by Mr. Bee is still safer - though this would equally mess up the sequence if a deletion happens - BUT, you can just manually go change the values in that column then until they are happy again and the trigger should perform business-as-usual from then on.

Just another thought,
Have a great day!


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to