0nir
0nir

Reputation: 1355

Convert nvarchar scientific notation value into number in SQL Server 2014

I have a column loaded into SQL Server with these nvarchar values:

ColumnName
==========
6.19e+014
.....    
6.19e+014

Now, what would be the easiest way to convert this value into numbers again.

Kindly suggest. Thanks!

Upvotes: 0

Views: 3625

Answers (3)

Vigya
Vigya

Reputation: 142

Also, try this

Select convert(numeric(15,0),ltrim(rtrim(str(column_name,15))))
from table_name

Upvotes: 0

John Cappelletti
John Cappelletti

Reputation: 81990

declare @String varchar(25)='6.19e+014'

Select cast(@String as float)

Returns 619000000000000

Upvotes: 1

Hart CO
Hart CO

Reputation: 34784

This will cast to FLOAT without issue:

SELECT CAST('6.19e+014' AS FLOAT)  

If what you really want is the specific value that got converted to scientific notation in the first place, you'll have to go back in the process to before it got converted and fix that.

Upvotes: 0

Related Questions