Sequence vs identity

后端 未结 6 917
南方客
南方客 2020-11-29 20:20

SQL Server 2012 introduced Sequence as a new feature, same as in Oracle and Postgres. Where sequences are preferred over identities? And why do we need sequence

6条回答
  •  日久生厌
    2020-11-29 20:38

    I know this is a little old, but wanted to add an observation that bit me.

    I switched from identity to sequence to have my indexes in order. I later found out that sequence doesn't transfer with replication. I started getting key violations after I setup replication between two databases since the sequences were not in sync. just something to watch out for before you make a decision.

提交回复
热议问题