开发者

How do I reset the Primary Key index to 1 using Visual Studio 2008 Server Explorer?

How do I reset the Primary Key index to 1 using Visual Studio 2008 Server Expl开发者_运维技巧orer?

Thanks!


To reset the IDENTITY value to one, use DBCC CHECKIDENT:

DBCC CHECKIDENT (‘YOUR_TABLE_NAME_HERE’, RESEED, 1)


It sounds like you have a table, with data, and you want to restart PK Identity numbering back to 1.

You'll have to delete all data and reset the seed on the identity column. This can be done all in one statement.

Create a new query by right-clicking on the database server or a table, and choose New query (or whatever command is similar):

TRUNCATE TABLE MyTable;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜