sys.sequences (Transact-SQL)
TOC
Collapse the table of content
Expand the table of content

sys.sequences (Transact-SQL)

 

Updated: June 10, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Contains a row for each sequence object in a database.

Column nameData typeDescription
<inherited columns>Inherits all columns from sys.objects.
start_valuesql_variant NOT NULLThe starting value for the sequence object. If the sequence object is restarted by using ALTER SEQUENCE it will restart at this value. When the sequence object cycles it proceeds to the minimum_value or maximum_value, not the start_value.
incrementsql_variant NOT NULLThe value that is used to increment the sequence object after each generated value.
minimum_valuesql_variant NULLThe minimum value that can be generated by the sequence object. After this value is reached, the sequence object will either return an error when trying to generate more values or restart if the CYCLE option is specified. If no MINVALUE has been specified, this column returns the minimum value supported by the sequence generator’s data type.
maximum_valuesql_variant NULLThe maximum value that can be generated by the sequence object. After this value is reached the sequence object will either start returning an error when trying to generate more values or restart if the CYCLE option is specified. If no MAXVALUE has been specified this column returns the maximum value supported by the sequence object's data type.
is_cyclingbit NOT NULLReturns 0 if NO CYCLE has been specified for the sequence object and 1 if CYCLE has been specified.
is_cachedbit NOT NULLReturns 0 if NO CACHE has been specified for the sequence object and 1 if CACHE has been specified.
cache_sizeint NULLReturns the specified cache size for the sequence object. This column contains NULL if the sequence was created with the NO CACHE option or if CACHE was specified without specifying a cache size. If the value specified by the cache size is larger than the maximum number of values that can be returned by the sequence object, that unobtainable cache size is still displayed.
system_type_idtinyint NOT NULLID of the system type for sequence object’s data type.
user_type_idint NOT NULLID of the data type for the sequence object as defined by the user.
precisiontinyint NOT NULLMax precision of the data type.
scaletinyint NOT NULLMax scale of the type. Scale is returned together with precision to give users complete metadata. Scale is always 0 for sequence objects because only integer types are allowed.
current_valuesql_variant NOT NULLThe last value obligated. That is, the value returned from the most recent execution of the NEXT VALUE FOR function or the last value from executing the sp_sequence_get_range procedure. Returns the START WITH value if the sequence has never been used.
is_exhaustedbit NOT NULL0 indicates that more values can be generated from the sequence. 1 indicates that the sequence object has reached the MAXVALUE parameter and the sequence is not set to CYCLE. The NEXT VALUE FOR function returns an error until the sequence is restarted by using ALTER SEQUENCE.

In SQL Server 2005 and later versions, the visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.

Sequence Numbers
CREATE SEQUENCE (Transact-SQL)
ALTER SEQUENCE (Transact-SQL)
DROP SEQUENCE (Transact-SQL)
NEXT VALUE FOR (Transact-SQL)
sp_sequence_get_range (Transact-SQL)

Community Additions

ADD
Show:
© 2016 Microsoft