Subject Re: [firebird-support] reset autoincrement field
Author Helen Borrie
Nico Speleers wrote:

> How can I reset an autoincrement field in firebird 3 ? I used
> identity to make an autoincrement field.

In your Fb 3 installation is the /doc/ directory, where you will find
the release notes in PDF form. IDENTITY is documented on page 69
(page 79 by the PDF numbering), including the syntax for making the
(otherwise inaccessible) generator restart with a different value.

Syntax works ONLY with an IDENTITY column.

To re-initialise to zero:

alter table aTable
alter column aTable_ID RESTART

The next number generated will be 1.

To re-intialise to some other number:

alter table aTable
alter column aTable_id RESTART WITH n

The next number generated will be (n+1).

Remember to COMMIT if you are not using isql with autoddl on.

HB