title: Happens occasionally: "Error converting data type nvarchar to float"
body: <p>Here is my SQL query:</p>
  
  <pre><code>SELECT (CAST(CAST([rssi1] AS float) AS INT))*-1, CONVERT(VARCHAR(10), [date], 110)
  FROM history
  WHERE id IN
  (
      SELECT TOP 8 id
      FROM history
      WHERE ([siteName] = 'CAL00022') 
      ORDER BY id DESC
  )
  ORDER BY date ASC
  </code></pre>
  
  <p>Most of the time, it works fine. <strong>Sometimes</strong>, I get this error:</p>
  
  <pre><code>Server Error in '/' Application.
  Error converting data type nvarchar to float.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  Exception Details: System.Data.SqlClient.SqlException: Error converting data type nvarchar to float.
  </code></pre>
  
  <p>The table is this:</p>
  
  <p><img src="https://i.stack.imgur.com/whTlb.png" alt="enter image description here"></p>