Exponential conversion to number is wrong in SQL Server

222 Views Asked by At

I am inserting some data from python to sql server. In the dataframe, the data looks ok. However after inserting into sql table, the number converts to some exponential expression. I tried to convert it into a number but the output is not correct. Below is the screenshot of the data in the table:

enter image description here

The first row number should be: 9013513. However, when I convert the exponential number to real number using the code below, it comes out as 9013510. Below is my code:

declare @stproduct nvarchar(255) 
set @stproduct = '9.01351e+006'
SELECT CONVERT(numeric(16,0), CAST(@stproduct AS FLOAT))
0

There are 0 best solutions below