In mysql if I change a field type, which changes would ruin the data? I assume varchar to int would eliminate the data even if it is numerical. I'm trying to think what I ened to do because I need to change a lot of fields either from varchar to int or from int to varchar and I have a lot of rows with values. I guess I should make temporary fields to keep data in while I change the others.
I assume changing within the same field type would cause no problems? Such as if I change from int to small int, as long as the value was not more than the small int limit it would remain in tact?
I can test this, but I am busy right now so figured I would ask inc ase when I get back someone has answered.
Changing Field Types
Started by BASHERS33, May 15 2009 10:42 AM
2 replies to this topic
#1
Posted 15 May 2009 - 10:42 AM
|
|
|
#2
Posted 15 May 2009 - 12:25 PM
I think mysql tries to convert if possible. the other way around keeps the data at least.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 15 May 2009 - 06:24 PM
You could just make a temp database - convert all the varchars to int in php and see if it works - drop the other table rename the temp one


Sign In
Create Account


Back to top










