简体   繁体   中英

Convert Varchar with Exponent to Decimal Data type

I have column Amount with 10,000 records and its look like this.

1.24E4

27.27E1

3.25E2

and etc.

Now I need to update the column to make this result

12400

272.7

325

I need to know how to convert and update the column from varchar to decimal.

Take note that my Column Amount is in Varchar Data type.

select convert(float, '1.24E4')
select convert(float, '27.27E1')
select convert(float, '3.25E2')

Simply update with a cast to FLOAT:

UPDATE YOUR_TABLE
SET YOUR_COLUMN = CAST(YOUR_COLUMN AS FLOAT)
WHERE....your condition if there

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM