Today I needed to do a very unusual operation – reset the index in the table in MS SQL. I honestly did not think, that makes it so easy to. To do this, use the command:
DBCC CHECKIDENT (nazwa_tabeli, reseed, ostatni_indeks)
In the command, give the name of the table, where we want to reset the index and the number of the last index in the table. If you want to automatically generate numbers that began with the 1 it must use this command in the following manner:
DBCC CHECKIDENT (nazwa_tabeli, reseed, 0)
It should be remembered, that the use of this command may cause an error, in a situation, when we determine the first value below the value used in the table already.