database - MySQL convert data in float field to decimal field -


i have data in mysql table mistakenly stored float data type. example:

7.45

i need convert data decimal type don't run rounding errors going forward.

if this:

alter table `invoice_line` change `line_quantity` `line_quantity` decimal(18,6) unsigned not null after `line_rate`; 

i end values in table:

70.449997

how can correctly convert data on decimal without mangling data?

i use mysqldump (or mysql workbench has utility well) dump table. alter , recreate it. adding precision going introduce errors because floating point numbers imprecise anyways.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -