Mutley Posted June 1, 2007 Share Posted June 1, 2007 I set my field to the wrong type so entered loads of data like this: 0.1 0.2 0.3 etc It changed it to .1 .2 .3 How do I mass change my fields, so I don't have to re-enter it all? What field type do I need? INT? Quote Link to comment https://forums.phpfreaks.com/topic/53836-wrong-field-type-changing-entries-from-1-to-01/ Share on other sites More sharing options...
Mutley Posted June 1, 2007 Author Share Posted June 1, 2007 I had it on CHAR but only set length to 2, not 3! Oops. Quote Link to comment https://forums.phpfreaks.com/topic/53836-wrong-field-type-changing-entries-from-1-to-01/#findComment-266140 Share on other sites More sharing options...
AndyB Posted June 1, 2007 Share Posted June 1, 2007 If they're numerical, why would you use CHAR as a field type instead of FLOAT? Quote Link to comment https://forums.phpfreaks.com/topic/53836-wrong-field-type-changing-entries-from-1-to-01/#findComment-266157 Share on other sites More sharing options...
bubblegum.anarchy Posted June 1, 2007 Share Posted June 1, 2007 A simple solution: ALTER TABLE table_name MODIFY column_name FLOAT NOT NULL DEFAULT 0; All the values .1 .2 etc.. will become 0.1 0.2 etc... EDIT: Just be aware that non numeric values will be converted to zero. Quote Link to comment https://forums.phpfreaks.com/topic/53836-wrong-field-type-changing-entries-from-1-to-01/#findComment-266177 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.