Search code examples
sql-serversql-server-2012type-conversionnumericvarchar

How do I convert a varchar containing a number in scientific notation to a numeric in SQL Server?


I made some calculations using function and get the following value. I want to divide this value with 1000.

1.83673e+006

I want to convert the value into numeric.

When I try to convert it to numeric it throws

Error converting data type nvarchar to numeric.

Is it possible to convert this value to numeric? Please help me to get this.

Thanks in advance


Solution

  • try it

    SELECT CONVERT(numeric(16,0), CAST(1.83673e+006 AS FLOAT))