开发者

parse currency formated number to float in mysql

开发者 https://www.devze.com 2022-12-13 09:20 出处:网络
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 col

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 of float
  • 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 )

0

精彩评论

暂无评论...
验证码 换一张
取 消