本文介绍了在sql server中重置身份种子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

步骤1:我有一个带有身份的表(1,1)[RoleID]和[描述]

步骤2:我创建了storedprocedure来插入已插入5条记录的记录。

Step3:插入记录时不需要给RileID,因为那是自动插入的标识栏。

Step4:这是我的问题

1 I必须回滚(删除最近的记录,其中RoleID = 5)

2已删除罚款

3如果我想再次插入记录,该记录应该有RoleID 5已经从该表中插入和删除。

4如何在sql server中执行此操作。

解决方案

Step1: I have a table with identity(1,1) [RoleID] and [Description]
Step2: I have created storedprocedure to insert record that has inserted 5 records that is fine.
Step3: While insert the record no need to give RileID because that is identity column automatically inserted.
Step4: Here is my question
1 I have to rollback (Delete recent record which is RoleID =5)
2 That has deleted fine
3 If i want to insert record again that record should be have RoleID 5 which is already inserted and deleted from that table.
4 how to do this in sql server.

解决方案


这篇关于在sql server中重置身份种子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 08:37