I want to set the auto_increment value for each column by first finding the max id value.
I am referencing the code from this SO question.
The mysql docs for prepared statements show a similar format, so I am confused.
When I try running the prepare statement I get a failure. Why?
Below is the output when I try to prepare a regular statement and then when I try to prepare the auto_increment statement with a '?' for binding later.
mysql> PREPARE stmt1 FROM 'ALTER TABLE user AUTO_INCREMENT=2';
Query OK, 0 rows affected (0.00 sec)
Statement prepared
mysql> PREPARE stmt1 FROM 'ALTER TABLE user AUTO_INCREMENT=?';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1