Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

modify int to float (mysql)

Tags:

sql

mysql

I'm trying to change datatype from INT to FLOAT in MySQL like this:

ALTER TABLE user MODIFY rate float(5) NOT NULL

But current data is droped. Is there any way to convent\save data from INT to FLOAT with SQL?

like image 247
Yevgen Avatar asked Apr 07 '13 06:04

Yevgen


1 Answers

I have just tried

ALTER TABLE user MODIFY rate float(5) NOT NULL

with mysql 5.6.26 and it worked without dropping the value.

like image 135
Fran García Avatar answered Sep 30 '22 03:09

Fran García