Firebird Documentation Index → Firebird 2.0 Language Ref. Update → DDL statements → CREATE SEQUENCE |
Find a more recent version at Firebird 5.0 Language Reference: SEQUENCE (GENERATOR)
Available in: DSQL
Added in: 2.0
Description: Creates a new sequence or generator. SEQUENCE is the SQL-compliant term for what InterBase and Firebird have always called a generator. CREATE SEQUENCE is fully equivalent to CREATE GENERATOR and is the recommended syntax from Firebird 2.0 onward.
Syntax:
CREATE SEQUENCEsequence-name
Example:
create sequence seqtest
Because internally sequences and generators are the same thing, you can freely mix the generator and sequence syntaxes, even when operating on the same object. This is not recommended however.
Sequences (or generators) are always stored as 64-bit integer values, regardless of the database dialect. However:
If the client dialect is set to 1, the server passes generator values as truncated 32-bit values to the client.
If generator values are fed into a 32-bit field or variable, all goes well until the actual value exceeds the 32-bit range. At that point, a dialect 3 database will raise an error whereas a dialect 1 database will silently truncate the value (which could also lead to an error, e.g. if the receiving field has a unique key defined on it).
See also: ALTER SEQUENCE, NEXT VALUE FOR, DROP SEQUENCE
Firebird Documentation Index → Firebird 2.0 Language Ref. Update → DDL statements → CREATE SEQUENCE |