Subject Re: [ib-support] SQL-SELECT/DELETE unique value from table in multiuser app
Author Woody
From: "Dale Mullins" <dale_mullins@...>
>
> How do I guarantee that an ACCOUNT_NUMBER does not get used more than
> once if two or more users are inserting at the same time? I think I
> want to lock the DOWNTIME_ACCOUNTS table, get the first record, delete
> the record, then unlock the table. Am I thinking correctly? :) If so,
> how is this implemented via Delphi & ODBC?
>

Use a generator and a trigger. Use a before/after insert trigger to assign
the generator value to the field if it's null. A generator is not controlled
by transactions so you get a different value regardless of timing.

Woody (TMW)