Subject Re: Firebird_2 - Zeos_dbo 6.5.1 - "alter sequence"
Author Adam
--- In, Svein Erling Tysvær
<svein.erling.tysvaer@...> wrote:
> Hi Gianni!
> Is 'alter sequence' a valid command in Firebird? There are (at least)
> two other ways to do this, the one I would recommend would be:
> select gen_id(sss, 7777-gen_id(sss,0)) from rdb$database
> The above should work in most cases, though if someone simultaneously
> got the next value, I wouldn't bet on the generator not getting the
> value 7778.
> HTH,
> Set

Resetting a generator (aka sequence) is not a normal database
operation. Because it is transaction independent (does not rollback,
may unpredictably change in a multi-transaction environment), it has
the potential to cause headaches. Whilst useful in terms of
development procedures and maybe even some maintenance procedures, it
is not usually a good idea in a production environment.

Sequences are new in FB2, well not really 'new', generators have been
around for donkeys ages, but FB2 is the first firebird version to
support the SQL2003 syntax for them, but the features' support is
incomplete. Read the release notes for support issues relating to FB 2
functionality, particularly relating to where support queries should
be asked. There is also a readme inside doc/sql.extensions/ of interest.

The statement:

set Generator [generator name] to 0

should work fine in FB 2 and all previous versions of Firebird.