title: SQL divide two integers and get a decimal value error
body: <p>In an SQL statement, I am trying to divide two integers (integer 1 is "abc" in my code below, integer 2 is "xyz" in my code), and get a result as a decimal (def in my code below). The decimal result should have a leading 1 or 0 only, followed by a decimal and 3 numbers after the decimal. However my code keeps returning a straight 0 with no decimals.</p>
  
  <pre><code>SELECT CONVERT(DECIMAL(4,3), abc/xyz) AS def
  </code></pre>
  
  <p>This code results in "0", when what I want is something like "0.001" or "0.963". I believe that it is still looking at "def" as an integer, and not as a decimal.</p>
  
  <p>I have also tried using CAST on abc and xyz but it returns the same thing. I have also tried the following code:</p>
  
  <pre><code>SELECT CONVERT(DECIMAL(4,3), abc/xyz) AS CONVERT(DECIMAL(4,3)def)
  </code></pre>
  
  <p>But this gives me an error, saying there is a syntax error near the word "CONVERT".</p>