reset primary key (mysql)
-
I have a primary key in StudentTable in mySQL database called (schoolDB)... I was using it for testing and now i want to rest the primary key to start from 1 how can I do that?
-
I have a primary key in StudentTable in mySQL database called (schoolDB)... I was using it for testing and now i want to rest the primary key to start from 1 how can I do that?
-
I have a primary key in StudentTable in mySQL database called (schoolDB)... I was using it for testing and now i want to rest the primary key to start from 1 how can I do that?
1. http://www.google.com/search?q=mysql+reset+primary+key[^] 2. IMO it should not matter; a primary key has one and only one function: it needs to be unique, it does not matter what the values actually are. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
1. http://www.google.com/search?q=mysql+reset+primary+key[^] 2. IMO it should not matter; a primary key has one and only one function: it needs to be unique, it does not matter what the values actually are. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
You're oversimplifying things a bit in my opinion. It does need to be unique, and it does not matter what the values actually are if you are using surrogate keys. But there is such a thing as natural keys, and there's nothing wrong in using them if it fits the model. Here[^] is yet another article on the subject by Joe Celko.
"When did ignorance become a point of view" - Dilbert
-
You're oversimplifying things a bit in my opinion. It does need to be unique, and it does not matter what the values actually are if you are using surrogate keys. But there is such a thing as natural keys, and there's nothing wrong in using them if it fits the model. Here[^] is yet another article on the subject by Joe Celko.
"When did ignorance become a point of view" - Dilbert
Jörgen Andersson wrote:
You're oversimplifying things a bit in my opinion
I'm sure I was. Thanks for the link, I'll read the article. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
I have a primary key in StudentTable in mySQL database called (schoolDB)... I was using it for testing and now i want to rest the primary key to start from 1 how can I do that?
Use
DBCC CHECKIDENT('Customer', RESEED, 0)
for Resetting Identity seed.
Regards, Hiren. "We owe a lot to the Indians, who taught us how to count, without which no worthwhile scientific discovery could have been made." - Einstein Microsoft Dynamics CRM