Subject Re: [firebird-support] Auto increment
Author Martijn Tonies
> >>Part 1, Part 2
> >>1 1
> >>1 2
> >>2 1
> >>1 3
> >>2 2
> >>3 1
> >>1 4
> >>3 2
> >>
> >>What is the best way to solve this? I think I need a generator which
> >>gets the last number (part 2) there is for a given entry (part1) and
> >>increment that value.
>
> My suggestion would be to store current timestamp as part 2
> but only if the part 2 sequence is supposed to represent the
> creation order of the entries.
>
> You can then (if required) generate an ordinal contiguous
> number sequence however apart for listing re-ordering
> I have yet to find a need for this.
>
> Even in the case of listing re-ordering (MOVEUP/MOVEDOWN)
> numbers do not have to be contiguous and a single
> sequence (such as that created by a generator) will do the trick.

Ordering? What ordering? Rows stored aren't ordered.

Only rows retrieved are ordered.

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com