Can anyone explain in greater (and more comprehensive) detail what the
RESTART option does in the ALTER TABLE table ALTER COLUMN statement.
This is the description in Info Center:
RESTART or RESTART WITH numeric-constant
Resets the state of the sequence associated with the identity column.
If WITH numeric-constant is not specified, the sequence for the
identity column is restarted at the value that was specified, either
implicitly or explicitly, as the starting value when the identity
column was originally created.
The column must exist in the specified table (SQLSTATE 42703), and must
already be defined with the IDENTITY attribute (SQLSTATE 42837).
RESTART does not change the original START WITH value.
The numeric-constant is an exact numeric constant that can be any
positive or negative value that could be assigned to this column
(SQLSTATE 42815), without non-zero digits existing to the right of the
decimal point (SQLSTATE 428FA). The numeric-constant will be used as
the next value for the column.
Really the only statement in this write up that explains what it is for
is the 'Resets the state of the sequence'.
I am curious if it has something to do with recalculating (reindexing)
the sequence numbers everytime??? the database is restarted?? or
something like that.
The reason I ask is I was looking around for an easy (automatic) way to
do this task without having to add code to update the column every so
often in order to avoid hitting the MAXVALUE on a column that is set to
NO CYCLE. Since my settings are such that I wont really have to worry
about the MAXVALUE for this table column for years...it would be nice
to not have to worry about it at all...and without having to kick
something off once a month to clean up.
So could setting the RESTART do something for this?