SQL Server 2012 Features:2:Sequencing

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

Sequence part1


Sequence part2 ssms

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 ;


About Mirza Husain

Mirza Husain is a senior consultant-database and having more than 10+ years of experience in the IT industry with different domains. He is fond of writing and speaking about SQL Server and also keen to learn new technologies. He is holding MCA degree and having Microsoft certifications as MCP & MCTS. He is also ITIL certified. In his past years, he worked with many clients as Microsoft, Bank of America etc. Currently he is associated with a France based client and offering his best services. You may reach him on his email id -- mirza_dba@outlook.com. Thanks!
This entry was posted in Database Administration, Sql Server New Feature. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s