parse currency formated number to float in mysql
I have a column in mysql of float type, I need to load curr开发者_Python百科ency like numbers($300) into this column, how do I do that in MYSQL? (let's not argue about the choice of float for this column)
- create temporary table with
varchar2
instead offloat
- load file in temporary table
copy data from temporary table to real table and use msql functions to convert the currency into a float, using something like:
(CAST ( SUBSTRING( TRIM( amountStr ), 1 ) AS FLOAT )
精彩评论