开发者

Will MySQL ALTER TABLE reformat field data?

I need to alter a t开发者_如何学编程able to change the Type of a column. If the current column Type is DECIMAL(8,2) and I alter that column to be DOUBLE, will the already-existing data in the column also be changed to reflect the column's new Type?


It should. However, always be safe when altering existing tables.

My preferred way of doing this type of operation is:

  1. make a backup
  2. create a new column
  3. update all rows moving the old data over to new column
  4. inspect the new column for anything wrong and fix if necessary
  5. delete the old column
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜