Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mass changing primary keys

Status
Not open for further replies.

Dustman

Programmer
May 7, 2001
320
US
I'm not to familiar with mySQL. I'm pretty sure I can figure out a php script to do this but I figured I'd see if there is an easier way before I do that.

I've got two identical tables.. one of them has about 26000 records in it. The other has 11000 posts in it, 10000 of which are the same records as the first 10000 in the larger db. The primary key's are incrementing. What I need to do is change the primary keys of the last 1000 of the smaller db to make them fit in after the 26000.

Why? These are ikonboard tables. We had a server crash and the only backup we had was from 3 months ago. We restored to it and didn't think we could recover the other 16000 posts so we just opened the board back up again. Lo and behold I was able to salvage the other table but not before about 1000 new posts were made. I need to use an insert into query from one table to the other. If I don't run some kind of script to change the post_id's of the new posts before i do that, i'll lose the 1000 posts they've made since the restore. I hope this makes sense. Any suggestions?

The primary keys are bigint(20). -Dustin
Rom 8:28
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top