title: How to convert/cast varchar to float?
body: <p>I just need to bulk update data. For this, I've created a table type and stored procedure.</p>
  
  <p>I've created type with this:</p>
  
  <pre><code>CREATE TYPE [dbo].[ItemsUpdate] AS TABLE
  (
    [ItemPartNumber] [varchar](100) NULL,
    [VendorName]     [varchar](100) NULL,
    [Price]          [varchar](100) NULL
  )
  GO
  </code></pre>
  
  <p>And my stored procedure be like this:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[UpdateItemsByVendorPrice]
     @tblItemUpdate ItemsUpdate READONLY
  AS
  BEGIN
    SET NOCOUNT ON;
  
    MERGE INTO Items orgTable
    USING @tblItemUpdate typeTable ON orgTable.ItemPartNumber = typeTable.ItemPartNumber
  
    WHEN MATCHED THEN
       UPDATE SET orgTable.Price = CONVERT(FLOAT, typeTable.Price);
  END
  </code></pre>
  
  <p>Even though, I used <code>convert(float,typeTable.Price)</code>, I got this error.</p>
  
  <blockquote>
    <p>An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll</p>
    
    <p>Additional information: Error converting data type varchar to float</p>
  </blockquote>