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:
-
the specified value is
DEFAULT
;this generates the identity value as normal. -
the
OVERRIDING SYSTEM VALUE
clause is specified in theINSERT
statement;this allows a user value to be inserted; -
the
OVERRIDING USER VALUE
clause is specified in theINSERT
statement;this allows a user specified value to be ignored (though in general it makes more sense to not include the column in theINSERT
).