CREATE SEQUENCE
defines a sequence
What changes
- Input
- catalog
- Output or change
- sequence object (start, increment, cycle, cache)
Syntax at a glance
CREATE SEQUENCE [ schema_name . ] sequence_name [ AS [ built_in_integer_type | user-defined_integer_type ] ] [ START WITH <constant> ] [ INCREMENT BY <constant> ] [ { MINVALUE [ <constant> ] } | { NO MINVALUE } ] [ { MAXVALUE [ <constant> ] } | { NO MAXVALUE } ] [ CYCLE | { NO CYCLE } ] [ { CACHE [ <constant> ] } | { NO CACHE } ] [ ; ]
Work example
Several tables need values from one database sequence.
Review type, increment, bounds, cache choice, and restart rules against the business key contract.
Check your work Concurrent lab requests produce valid values and the sequence does not promise gap-free numbering.
Open Microsoft Learn for full syntax, permissions, and details for your version.