且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除后重置 SQL Server 中的自动增量

更新时间:2022-12-04 21:08:46

发出以下命令以重新播种 mytable 以从 1 开始:

Issue the following command to reseed mytable to start at 1:

DBCC CHECKIDENT (mytable, RESEED, 0)

在在线书籍(BOL、SQL 帮助)中阅读有关它的信息.还要注意您的记录不要高于您设置的种子.

Read about it in the Books on Line (BOL, SQL help). Also be careful that you don't have records higher than the seed you are setting.