database - Converting Scientific Notation to float (string to float) in SQL (Redshift) -
i trying convert/cast string of scientific notation (for example, '9.62809864308e-05') float in sql.
i tried standard method: convert(float, x) x = '9.62809864308e-05', returns error message: unimplemented fixed char conversion function - bpchar_float8:2585.
what i'm doing straightforward. table has 2 columns: id , rate (with rate being string scientific notation trying cast float). added 3rd column table , tried populate 3rd column float representation of x:
update my_table set 3rd_column = convert(float, 2nd_column)
data type of 2nd_column
char(20)
furthermore, not every string float in scientific notation -- in normal float notation. i'm wondering if there built in function can take care of of this.
thank you!
turns out string representation of float x, let's x = '0.00023' or x = '2.3e-04'
convert(float, x) convert data type of x char (string) float.
the reason why didn't work me string contained white spaces.
Comments
Post a Comment