简体   繁体   English

我可以撤消-MySQL中的ALTER表吗?

[英]Can i undo ALTER table in - MySQL?

Don't know if it's possible, I Altered VARCHAR column to Decimal Type which i want to Rollback. 不知道是否有可能,我将VARCHAR列更改为要回滚的Decimal Type。 Because it blended all floating values as integer. 因为它将所有浮点值混合为整数。 like 2.00 became 200. Is there any way to undo my last table Alteration? 像2.00变成200。有什么办法可以撤消我的上一张表变更? Please advise. 请指教。

No, you can't roll back ALTER TABLE statements. 不,您不能回滚ALTER TABLE语句。

https://dev.mysql.com/doc/refman/5.7/en/cannot-roll-back.html https://dev.mysql.com/doc/refman/5.7/zh-CN/cannot-roll-back.html

Some statements cannot be rolled back. 某些语句无法回滚。 In general, these include data definition language (DDL) statements, such as those that create or drop databases, those that create, drop, or alter tables or stored routines. 通常,这些语句包括数据定义语言(DDL)语句,例如创建或删除数据库的语句,创建,删除或更改表或存储例程的语句。

(emphasis mine) (强调我的)

As Chris Peters comments above, you can do the reverse ALTER TABLE operation, and then clean up your data using UPDATE statements. 正如Chris Peters所说,可以执行反向ALTER TABLE操作,然后使用UPDATE语句清理数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM