Complex Table Changes

Complex table structure changes usually require a manual move process involving these steps:

  1. Create a new table with the new column layout.
  2. Use INSERT SELECT statement to copy data from the old table to the new table.
  3. Verify that the new table contains the desired data.
  4. Rename the old table (or delete it if you are brave)
  5. Rename the new table with the name previously used by the old table.
  6. Recreate any triggers, stored procedures, indexes, and foreign keys as needed.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License