sys.sp_sequence_get_range
generalDescription
Returns a range of sequence values from a sequence object. The sequence object generates and issues the number of values requested and provides the application with metadata related For a more information about sequence numbers, see The name of the sequence object. The schema is optional. The number of values to fetch from the sequence.
Syntax
sp_sequence_get_range
[ @sequence_name = ]
N
'sequence_name'
, [ @range_size = ] range_size
, [ @range_first_value = ] range_first_value
OUTPUT
[ , [ @range_last_value = ] range_last_value
OUTPUT
]
[ , [ @range_cycle_count = ] range_cycle_count
OUTPUT
]
[ , [ @sequence_increment = ] sequence_increment
OUTPUT
]
[ , [ @sequence_min_value = ] sequence_min_value
OUTPUT
]
[ , [ @sequence_max_value = ] sequence_max_value
OUTPUT
]
[ ; ]
Permissions
Description ID of the system type for sequence object’s data type. ID of the data type for the sequence object as defined by the user. Max precision of the data type. Max 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. sql_variant The 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 procedure. Returns the START WITH value if the sequence has never been used. 0 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. sql_variant Returns the last value generated by the Next Value For function. Applies to SQL Server 2017 and later. In SQL Server 2005 (9.x) 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) See Also