简体   繁体   中英

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 Explorer?

Thanks!

要将IDENTITY值重置为1,请使用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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM