In continuation of previous blog..
A sequence is a user-defined schema bound object that generates a sequence of numeric values according to the specification with which the sequence was created. This sequence is generated in an order of ascending or descending at a defined interval. Sequence is not attached to a table.
A. Creating a sequence that increases by 1
create sequence dbo.empby1
start with 5
increment by 1
How to check sequence through t-sql:
select next value for dbo.empby1
B. Creating a sequence that decreases by 1
create sequence dbo.empneg1
start with 0
Increment by -1;
C. Creating a sequence using default values
create sequence dbo.mirzaseq ;