title: using decimal in where clause - Arithmetic overflow error converting nvarchar to data type numeric
body: <p>I got a sql server error and not sure how to fix it.I got a column 'NAME' in a view 'Products' with a type of <code>nvarchar(30)</code>, the query is generated dynamically in code so cannot quite change it.</p>
  
  <p>I got the 'Arithmetic overflow error converting nvarchar to data type numeric.' for the following query:</p>
  
  <pre><code>select * FROM Products WHERE  NAME=12.0
  </code></pre>
  
  <p>however the following query works fine:</p>
  
  <pre><code>select * FROM Products WHERE  NAME=112.0
  </code></pre>
  
  <p>I am quite confused by the error, I know I should put quotes around the number but just want know why the second query works and is there any settings could make the first query work?</p>
  
  <p>update: also</p>
  
  <pre><code>select * FROM Products WHERE  NAME=cast('12.0' as decimal(4,2))
  </code></pre>
  
  <p>doesn't work, but</p>
  
  <pre><code>select * FROM Products WHERE  NAME=cast('12.0' as decimal(5,2)) 
  </code></pre>
  
  <p>works, any particular reasons?</p>
  
  <p>Many thanks!</p>