guyfromfl Posted April 29, 2011 Share Posted April 29, 2011 I have a database that contains a Primary Key, but my boss wants me to renumber it to (current PK value) + 800000... So, PK 1 would become 800001, PK 2354 would be come 802354 etc... Is there a simple way to do this or should I write a script? Link to comment https://forums.phpfreaks.com/topic/235104-renumber-primary-key-ai/ Share on other sites More sharing options...
Pikachu2000 Posted April 29, 2011 Share Posted April 29, 2011 Tell your boss that this is a horrible idea and there is no reason in the world to do so, as manually jacking with a PK index can absolutely destroy the referential integrity of a database. Link to comment https://forums.phpfreaks.com/topic/235104-renumber-primary-key-ai/#findComment-1208260 Share on other sites More sharing options...
guyfromfl Posted April 29, 2011 Author Share Posted April 29, 2011 The table doesn't reference anything, otherwise I wouldn't try this. It's just a table of customers, but the sequence in place now overlaps older records in the way of handling customers, so there is data collision. I did see a work around where I can drop the table, redefine the AI # and put it back on the table. Link to comment https://forums.phpfreaks.com/topic/235104-renumber-primary-key-ai/#findComment-1208261 Share on other sites More sharing options...
fenway Posted May 1, 2011 Share Posted May 1, 2011 You can reset auto-increment. Link to comment https://forums.phpfreaks.com/topic/235104-renumber-primary-key-ai/#findComment-1209138 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.