[英]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? 如何使用Visual Studio 2008 Server Explorer将主键索引重置为1?
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. 听起来你有一张表,有数据,你想重新启动PK身份编号为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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.