How to reset primary key index to 1 using Visual Studio 2008 Server Explorer?

How to reset primary key index to 1 using Visual Studio 2008 Server Explorer?

Thank!

+3
source share
2 answers

It looks like you have a data table and you want to restart PK Identity numbering by 1.

You will need to delete all data and reset the seed in the identity column. This can be done in one statement.

Create a new query by right-clicking on the database server or in the table and select "New query" (or any other command):

TRUNCATE TABLE MyTable;
+3
source

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

DBCC CHECKIDENT (‘YOUR_TABLE_NAME_HERE’, RESEED, 1)
+10

Source: https://habr.com/ru/post/1762115/


All Articles