Environment: SQL Server 2008r2
In my database is a table whose primary field is defined as
Inserting and updating is no problem, deleting I'm beginning to wonder about though.
My problem is that after a row has been deleted, its index, (Seq), isn't removed. For example, beginning with three rows in the table, issue the following commands:
The result of the first Select, as expected: Seq 3 is gone. The second Select, though, shows that the Seq for the new row is 4, instead of 3.
Is there a way to delete the row, and free up its index?
In my database is a table whose primary field is defined as
Code:
[Seq] [int] IDENTITY(1,1) NOT NULL
Inserting and updating is no problem, deleting I'm beginning to wonder about though.
My problem is that after a row has been deleted, its index, (Seq), isn't removed. For example, beginning with three rows in the table, issue the following commands:
Code:
Delete from MyTable where Seq=3
Select * from MyTable
Insert into MyTable (Col1,Col2,Col3) values('a','b','c')
Select * from MyTable
The result of the first Select, as expected: Seq 3 is gone. The second Select, though, shows that the Seq for the new row is 4, instead of 3.
Is there a way to delete the row, and free up its index?