SQL Server: Convert varchar to decimal (with considering exponential
notation as well)
I need to convert data of a table and do some manipulation. one of the
columns datatype is Varchar, but it stores decimal numbers. I am
struggling in converting the varchar into decimal.
I have tried following CAST( @TempPercent1 AS DECIMAL(28, 16))
Problem is that data also has some values in exponential notation,
example: 1.61022e-016. The sql query is throwing error on encountering
such value. The error is Error converting data type varchar to numeric.
I need to know how to handle exponential notation values during varchar to
decimal conversion?
No comments:
Post a Comment