MySQL Forums
Forum List  »  Newbie

Setting Auto Increment Value From Another Table
Posted by: Lee Childress
Date: November 21, 2017 11:56AM

I am pulling data from a db used by another vendor to be used in a piece of software I am writing. Once I pull the data I need to set the auto increment value on the new database to match the original table.

My query is:
ALTER TABLE `manufacturers` AUTO_INCREMENT = (SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = `origina_database` AND TABLE_NAME = `manufacturers`);

I keep getting a syntax error but just can't figure out where I am going wrong. Any insight?

Options: ReplyQuote


Subject
Written By
Posted
Setting Auto Increment Value From Another Table
November 21, 2017 11:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.