Subject Re: [firebird-support] Unbroken series of numbers
Author Ann W. Harrison
At 03:55 PM 10/27/2004, =?ISO-8859-2?Q?Bogus=B3aw_Brandys?= wrote:

>I'd like to know how in Firebird is possible to have unbroken series of
>for example document's numbers but wrapped monthly for example.

The answer depends somewhat on how many documents you expect to store
and whether you need to be absolutely certain that you never get a hole
in the sequence.

If the answer that holes are OK, then use a generator and reset
it monthly.

If the answer is a few, and holes are not OK, then setup a table
that contains only the next number. Reset the number monthly.
Increment the value by updating the record that holds it before
storing the document. If your transaction rolls back, the number
becomes available again.

If the answer is a lot and holes are not OK, then you've got a
problem and should look at the "auditable sequences" answers.