title: SQL Server: Convert varchar to decimal (with considering exponential notation as well)
body: <p>I need to convert data of a table and do some manipulation.</p>
  
  <p>One of the column datatypes is <code>Varchar</code>, but it stores <strong>decimal</strong> numbers.
  I am struggling to convert the <code>varchar</code> into <code>decimal</code>.</p>
  
  <p>I have tried <code>CAST( @TempPercent1  AS DECIMAL(28, 16))</code></p>
  
  <p>Problem is that data also has some values in exponential notation, for example: <code>1.61022e-016</code>.</p>
  
  <p>The sql query is throwing error on encountering such value.
  The error is <code>Error converting data type varchar to numeric.</code></p>
  
  <p>How should I handle exponential notation values during varchar to decimal conversion?</p>