# Difference between Identity & Sequence in SQL Server.
- IDENTITY is a table column property.The IDENTITY property is tied to a particular table and cannot be shared among multiple tables since it is a table column property.
- On the flip side the SEQUENCE is a database object defined by the user and can be shared by multiple tables since is it is not tied to any table.
- To generate the next IDENTITY value, a new row has to be inserted into the table. On the other hand, the next VALUE for a SEQUENCE object can simply be generated using the NEXT VALUE FOR clause with the sequence object.
- The value for the IDENTITY property cannot be reset to its initial value(Except delete table with truncate). In contrast, the value for the SEQUENCE object can be reset.
- A maximum value cannot be set for the IDENTITY property. On the other hand, the maximum value for a SEQUENCE object can be defined.
No comments:
Post a Comment