Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can someone help me with this im using mysql yog and i change my field from varchar to date and it contains date data now it turns to 0000-00-00 how to get it back on its original data pls help
Posted

1 solution

I hate to say this, but...restore from your last backup.

When you change a datatype so radically, it doesn't try to parse them, it basically throws it away and starts again, because there is no guaranteed conversion from a varchar "hello" to a valid date.

When you have restored the old version, follow the advice here: http://stackoverflow.com/questions/7090231/how-to-convert-a-varchar-column-type-to-date-type-without-losing-the-dates[^]

But if you don't have a backup, you are pretty much stuffed - it's a complicated change to undo, if it is even possible.
 
Share this answer
 
Comments
Crixalis Paul 7-Feb-14 7:04am    
i want to do it even if it hard because you say it is possible please help me because the data is very important for me. plsss
OriginalGriff 7-Feb-14 7:15am    
Then you need to start googling for "MySql Undo Column type change" and hope like hell!
I know it can be done - under the right circumstances - in SQL Server, but I also know it is a tough job involving logs and reworking. In MySql I've never had to do it, so it may not even be possible.

You did do this to your development copy of the DB didn't you? Not the live production version?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900