Using a trigger to simulate a second identity column in SQL Server 2005

后端 未结 5 1761
我寻月下人不归
我寻月下人不归 2020-12-20 07:46

I have various reasons for needing to implement, in addition to the identity column PK, a second, concurrency safe, auto-incrementing column in a SQL Server 2005 database.

5条回答
  •  再見小時候
    2020-12-20 08:21

    if you never delete from the table, you could create a view with a materialized column that uses ROW_NUMBER().

    ALSO, a SQL Server identity can get out of sync with a user generated one, depending on the use of rollback.

提交回复
热议问题