Subject Re: [IBO] How to insert records in natural order? Please Heeeeeelp!!!!
Author Lester Caine
> In a TIBOQuery I filled the InsertSQL property. The query has
> CachedUpdates activated. When I insert 2 records(ApplyUpdates), they
> aren't inserted on server in natural order(the order I have post
> them).This is the order: the first is the last, and the last is first.
> How do I post in natural order? I need natural order because of an
> trigger who calculates some sumes relative the the prior records.
> Please help...

While I can see your problem, there is no such thing as
natural order in a relational database. While the inserts
could be posted in the order added, I would not necessarily
expect to find them at the end of the list! If you never
delete or edit the data once it is in, then you MAY be OK,
but I would expect the data to be inserted where there is space.

SO if you have something that MUST be related to the
previous last record, then I would say that you either add a
TIMESTAMP or a generator field so as to ensure 'natural
order', THEN the problem of Jason going back up the stack of
queued data can be addressed - I suspect it would have to be
handled by reference to the generator field.

The final problem with this is, of cause, the database is
multi-user, while YOU may only have one user, most people
would have several users all posting, THEN what determines
natural order <g>

Lester Caine
L.S.Caine Electronic Services