FirebirdSQL logo
 DOMAININDEX 

GENERATED ALWAYS

An identity column of type GENERATED ALWAYS will always generate a column value on insert.Explicitly inserting a value into a column of this type is not allowed, unless:

  1. the specified value is DEFAULT;this generates the identity value as normal.

  2. the OVERRIDING SYSTEM VALUE clause is specified in the INSERT statement;this allows a user value to be inserted;

  3. the OVERRIDING USER VALUE clause is specified in the INSERT statement;this allows a user specified value to be ignored (though in general it makes more sense to not include the column in the INSERT).

GENERATED BY DEFAULT

An identity column of type GENERATED BY DEFAULT will generate a value on insert if no value — other than DEFAULT — is specified on insert.When the OVERRIDING USER VALUE clause is specified in the INSERT statement, the user-provided value is ignored, and an identity value is generated (as if the column was not included in the insert, or the value DEFAULT was specified).

START WITH Option

The optional START WITH clause allows you to specify an initial value other than 1.This value is the first value generated when using NEXT VALUE FOR sequence.

INCREMENT Option

The optional INCREMENT clause allows you to specify another non-zero step value than 1.

Warning

The SQL standard specifies that if INCREMENT is specified with a negative value, and START WITH is not specified, that the first value generated should be the maximum of the column type (e.g. 231 - 1 for INTEGER).Instead, Firebird will start at 1.