Overview of sequences
A sequence is a named object in a database or schema that
supports the get next value
method. By using sequences,
you can generate unique numbers that can be used as surrogate key
values for primary key values, where the identification of rows within
a table would involve a large, compound primary key, or for other
purposes.
A sequence value is an integer that you can use wherever you would use numeric values. User sequences for the four integer types are supported: byteint, smallint, integer, and bigint.
You create a sequence with an initial value, an increment, a minimum, and a maximum value. You also specify whether the sequence cycles, which determines whether the sequence starts over when the endpoint is reached.
Sequences do not support cross-database access; you cannot obtain a sequence value from a sequence that is defined in a different database.