我有一个名为的表customer_master
,其中包含一个名为cust_id
autoincrement 设置为 1 的列。
当我们尝试插入记录时,它的工作正常并且插入了cust_id
1、2、3 和 4 等记录,但是当插入命令中产生错误时,我们会执行事务回滚,这意味着cust_id
没有插入 5,但是当我们插入另一条记录,cust_id
生成 6。它跳过cust_id
5。
我想对其进行设置,以便如果在插入命令中生成任何错误,则标识不会增加。
我们正在使用 c# 和 sql server 2005。