In this post we will discuss some of the difference between Sequence and Identity in Sql Server. Also you can check out my previous posts on:
Below are some of the differences between Sequence and Identity Column in SQL Server:
- Identity columns are specific to tables inside a database, where as Sequence is not for any table specific, it can be used in whole database.
- Identity columns values generated when a row inserted to a table, but you can get the sequence number before inserting a row.
- You can not change the value of the Identity column once inserted, but the sequence number can be changed after insertion into the table.
- Identity column guarantees uniqueness inside the table, but in case of Sequence you need to create unique index on the column.
- In case of Identity column, you cannot define minimum and maximum values, whether to allow cycling, and caching options or not. But these things can be archived through Sequence in Sql Server 2008.