title: SQL Server 2008: Error converting data type nvarchar to float
body: <p>Presently troubleshooting a problem where running this SQL query:</p>
  
  <pre><code>UPDATE tblBenchmarkData 
  SET OriginalValue = DataValue, OriginalUnitID = DataUnitID, 
      DataValue = CAST(DataValue AS float) * 1.335 
  WHERE 
      FieldDataSetID = '6956beeb-a1e7-47f2-96db-0044746ad6d5' 
      AND ZEGCodeID IN 
               (SELECT ZEGCodeID FROM tblZEGCode 
                WHERE(ZEGCode = 'C004') OR 
                     (LEFT(ZEGParentCode, 4) = 'C004'))
  </code></pre>
  
  <p>Results in the following error:</p>
  
  <blockquote>
    <p>Msg 8114, Level 16, State 5, Line 1<br>
    Error converting data type nvarchar to float.</p>
  </blockquote>
  
  <p>The really odd thing is, if I change the <code>UPDATE</code> to <code>SELECT</code> to inspect the values that are retrieved are numerical values:</p>
  
  <pre><code>SELECT DataValue 
  FROM tblBenchmarkData 
  WHERE FieldDataSetID = '6956beeb-a1e7-47f2-96db-0044746ad6d5' 
  AND ZEGCodeID IN 
           (SELECT ZEGCodeID 
            FROM tblZEGCode WHERE(ZEGCode = 'C004') OR 
                                 (LEFT(ZEGParentCode, 4) = 'C004'))
  </code></pre>
  
  <p>Here are the results:</p>
  
  <pre><code>DataValue
  2285260
  1205310
  </code></pre>
  
  <p>Would like to use <code>TRY_PARSE</code> or something like that; however, we are running on SQL Server 2008 rather than SQL Server 2012. Does anyone have any suggestions?  TIA.</p>