title: Arithmetic overflow error converting varchar to data type numeric. '10' <= 9.00
body: <p>Below is a subset of the kind of table structure and data i'm working with.</p>
  
  <pre><code>CREATE TABLE #Test
  (
       Val varchar(5)
      ,Type varchar(5)
  )
  
  INSERT #Test VALUES ('Yes','Text')
  INSERT #Test VALUES ('10','Int')
  INSERT #Test VALUES ('10.00','Float')
  INSERT #Test VALUES ('9.00','Float')
  INSERT #Test VALUES ('9','Int')
  </code></pre>
  
  <p>I want to write a query that will let me know if the column 'Val' is &lt;= 9.00 (must be of numeric data type). I did this by doing the following:</p>
  
  <pre><code>SELECT *
  FROM
      (
          SELECT Val
          FROM #Test
          WHERE Type = 'Int'
      ) IntsOnly
  WHERE IntsOnly.Val &lt;= 9.00
  </code></pre>
  
  <p>This gives me an arithmetic overflow error. However, if I exclude the row of data with the value '10':</p>
  
  <pre><code>SELECT *
  FROM
      (
          SELECT Val
          FROM #Test
          WHERE Type = 'Int'
          AND Val &lt;&gt; '10'
      ) IntsOnly
  WHERE IntsOnly.Val &lt;= 9.00
  </code></pre>
  
  <p>It works without any issue. <strong>My question is not how to fix this as I know I can simply convert the data to the format I require.</strong></p>
  
  <p>My question is why the value of '10' in the column 'Val' is returning an error. Surely the logic should just return 'False' and simply exclude the rows because '10' (which I assume is implicitly converted) is greater than 9.00.</p>
  
  <p>Thanks.</p>