SEQUENCE Objects Versus Identity Columns
Identity
columns and SEQUENCE
objects are similar in that both are methods you can use to generate sequential numbers. The main difference is that Identity
columns are part of the table definition, and you can only have one Identity
column per table. SEQUENCE
objects are independent database objects, and the sequence numbers generated can be used for any table or column.
You may want to consider using SEQUENCE
objects instead of Identity
columns under the following scenarios:
You need to know the sequence value before inserting into the table.
You want to share a series of sequence numbers between multiple ...
Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.