Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.0 (Français) » SQL Anywhere Server - SQL Usage » Using transactions and isolation levels » Primary key generation and concurrency

 

Using a sequence to generate unique values

You can use a sequence to generate values that are unique across multiple tables or that are different from a set of natural numbers. A sequence is created using the CREATE SEQUENCE statement. Sequence values are returned as BIGINT values.

For each connection, the most recent use of the next value is saved as the current value.

When you create a sequence, its definition includes the number of sequence values the database server holds in memory. When this cache is exhausted, the sequence cache is repopulated. If the database server fails, then sequence values that were held in the cache may be skipped.

 Obtaining values in a sequence

You must have DBA authority, be the owner of the sequence, or have been granted permission to use the sequence to execute these statements. For more information, see sequence-expression clause, SELECT statement.

 Choosing between sequences and autoincrement values
 Sequence example
 See also

Create a sequence
Alter a sequence
Drop a sequence