title: Convert from varchar to float SqlServer
body: <p>I have a column in <code>varchar</code> format and I would like to convert it to <code>float</code>. The values are like:</p>
  
  <pre><code>188234,62
  188235
  188235,43
  188235,88
  </code></pre>
  
  <p>So, When I try to convert it I get an error:</p>
  
  <pre><code>Error converting data type varchar to float.
  </code></pre>
  
  <p>I thought that maybe some fields are not numeric and I checked with <code>isnumeric()</code> function, according to the query I concluded that all the values are numeric. Then I tried different queries to convert the field types:</p>
  
  <p><strong>Query1:</strong></p>
  
  <pre><code>SELECT CarData.dbo.FinalData_OilLevel_new_send.KM 
  CASE WHEN ISNUMERIC(CarData.dbo.FinalData_OilLevel_new_send.KM) = 1
  THEN CAST(CarData.dbo.FinalData_OilLevel_new_send.KM AS FLOAT) 
  ELSE NULL 
  END
  FROM CarData.dbo.FinalData_OilLevel_new_send
  </code></pre>
  
  <p><strong>Query2:</strong></p>
  
  <pre><code>SELECT CASE ISNUMERIC(KM) WHEN 1 THEN CONVERT(float, KM)) ELSE null END from CarData.dbo.FinalData_OilLevel_new_send
  </code></pre>
  
  <p>However I always get the same error. Are there some other ways to convert <code>varchar</code> to <code>float</code>?</p>