Hi Friends,

Here is part 3 of my sequence of blogs on SEQUENCE object :)

In part 1, I blogged on how SEQUENCE objects in DENALI behave within transactions. You can see that here;

In part 2, I blogged on some basics on how to get started with SEQUENCE object and how to use it in table definitions: you can find that blog here;

In this blog, I want to show you what else you can do with a SEQUENCE object.

Creating a SEQUENCE Object:

Generating NEXT value for a SEQUENCE object:

Re-seeding a SEQUENCE object; note that SEQUENCE is a first class SQL Server object:

Altering a SEQUENCE object to change the increment value by using the INCREMENT clause:

Dropping a SEQUENCE object:

Suppose the minimum or maximum value of a SEQUENCE object is reached and you want to re-start it automatically (minimum in case the SEQUENCE object is descending in nature), you can use the CYCLE clause. For example;