title: Set AUTO_INCREMENT value programmatically
body: <p>So this works...</p>
  
  <pre><code>ALTER TABLE variation AUTO_INCREMENT = 10;
  </code></pre>
  
  <p>But I want to do this;</p>
  
  <pre><code>ALTER TABLE variation AUTO_INCREMENT = (SELECT MAX(id)+1 FROM old_db.varaition);
  </code></pre>
  
  <p>but that doesnt work, and neither does;</p>
  
  <pre><code>SELECT MAX(id)+1 INTO @old_auto_inc FROM old_db.variation 
  ALTER TABLE variation AUTO_INCREMENT = @old_auto_inc;
  </code></pre>
  
  <p>So does anyone know how to do this?</p>
  
  <p>( I'm trying to ensure that AUTO_INCREMENT keys dont collide between an old and a new site and need to do this automatically. So I can just run a script when the new db goes live )</p>