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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -