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? 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. 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? 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. 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
Archived
This topic is now archived and is closed to further replies.