RanaHaroon
RanaHaroon

Reputation: 453

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. Because it blended all floating values as integer. like 2.00 became 200. Is there any way to undo my last table Alteration? Please advise.

Upvotes: 4

Views: 11174

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562358

No, you can't roll back ALTER TABLE statements.

https://dev.mysql.com/doc/refman/5.7/en/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.

(emphasis mine)

As Chris Peters comments above, you can do the reverse ALTER TABLE operation, and then clean up your data using UPDATE statements.

Upvotes: 7

Related Questions