A week or so ago some data got imported into a db table. Simple table:
Id INT PK NOT NULL IDENTITY
Name VARCHAR(20)
Now, I noticed today that the first id starts at 0. Asking the kid, he was reseeding it during his testing. So the first entry was a zero. Was an accident.
I’m not sure how to best update the value. How can I push everything up one number? What pains me is that there’s also some FK dependencies. If I have Cascade Update, should that fix the dependencies?
Also, should I update each number (however I do that??) from the top down .. eg. from the highest number, then +1. Then go down.
First of all, why are you stressing? ID=0 is complete valid, if a bit unusual. (Note that Zero Is NOT
NULL)If you really want to get rid of the 0: