title: How to Use Round And nullif together?
body: <p>I have a column that calculates Unit Weight (g) by doing the following calculations</p>
  
  <pre><code>SELECT ROUND (Weight,0) / nullif ([Units per Carton],0) * 454 AS [Unit Weight (g)]
  FROM [Item Master]
  </code></pre>
  
  <p>I used the nullif to eliminate the divide by zero. but i also want to use the Round() on the divisor</p>
  
  <p><strong>i tried this:</strong></p>
  
  <pre><code>SELECT  ROUND (Weight,0) / nullif(Round([Units per Carton],0) * 454) AS [Unit Weight (g)]
  FROM [Item Master]
  </code></pre>
  
  <p><strong>i tried this:</strong></p>
  
  <pre><code>  SELECT  nullif (ROUND (Weight,0) / (Round([Units per Carton],0) * 454) AS [Unit Weight (g)]
      FROM [Item Master]
  </code></pre>
  
  <p>error:
  <strong>Msg 156, Level 15, State 1, Line 1
  Incorrect syntax near the keyword 'AS'.</strong></p>
  
  <p>**So how do i combine a round function with nullif on the divisor??  **</p>
  
  <p><strong>Newly Edited Code</strong></p>
  
  <pre><code>SELECT ROUND (Weight,0) / nullif([Units per Carton],0) * 454 AS [Unit Weight (g)]
  FROM [Item Master] 
  
  SELECT ROUND (Weight / NULLIF([Units per Carton],0),0) * 454 AS [Unit Weight (g)]
  FROM [Item Master]
  </code></pre>
  
  <p>I tried the above and the result i got is in this -> <a href="http://imgur.com/XLiiBpK" rel="nofollow">picture</a></p>
  
  <p>The results are different i wanted the result to be 151, 227 and 227 but those results are getting replaced by 0's.</p>