SQL Server: error converting data type nvarchar to float
<p>I have read many articles and tried several methods but don't have any luck.</p>

<p>I am importing table A (whose cost is <code>char</code> to table B (which requires <code>float</code>).</p>

<p>What I tried:</p>

<pre><code> --cast([Cost]   as float)
 -- cast(ISNULL([Cost],0)   as float)
 -- NULLIF(CAST(ISNULL([Cost],0)   as float), 0)
 convert(float,replace([Cost],',','') )[Cost]
</code></pre>

<p>Sample data</p>

<pre><code>FINAL Freight Cost
1248
1248
193.79
201.56
1475.71
97.86
97.86
97.86
125.49
97.86
447.83
450
492.99
450
</code></pre>

<p>And I still get this error:</p>

<blockquote>
  <p>Error converting data type nvarchar to float</p>
</blockquote>

<p>Update:</p>

<p>In addition, I am not sure how to modify the existing code based on the answers;</p>

<p>The existing code structure </p>

<pre><code>1. creat table B
2. insert into B () select[DestAddress], [COST] from A
</code></pre>

<p>I also tried <code>CAST(test AS FLOAT) AS CastedValue</code></p>

<hr>

<p>Why <code>float</code>? The dataset will be sent to an optimization algorithm which requires <code>float</code>. Thanks for pointing it out though.</p>