Yes, SQL Server SEQUENCE supports descending numbering. We can simply use a negative INCREMENT value. For example, INCREMENT BY -1 will generate values in reverse order. Sequence can even start from MAX value and go down to MIN value. This is not possible with IDENTITY.
See the demo
|
CREATE SEQUENCE Descending_Sequence_demo AS INT START WITH 1000 INCREMENT BY -1 MINVALUE 1; |
Here sequence is start 1000 and
decremented by 1.
See below
No comments:
Post a Comment
If you have any doubt, please let me know.