That said, as I put it the new records I tested a couple inside a transaction and then rolled them back to make a few changes. Then I input again and the primary key (really the foreign key for the other table) had a gap in the sequence and therefore wouldn't link up with the other table properly.
So I had to figure out how to remove the records I had just placed in said table and reset the index. There are two fairly easy solutions that I will outline below.
Solution 1
The first solution involves just using the query language to make the changes.
- Remove any records that you need to.
- You need to reset the primary key. Remember to use the number that is one below where you want your next ID to start. So if you want to start with 742, you would reseed with 741.
- Then re-run your inserts and it should be all set.
DBCC checkident ('TableNameGoesHere', reseed, 741)
Solution 2
The second solution uses the GUI.
No comments:
Post a Comment