title: How to do Formatting and Rounding numbers in T-SQL?
body: <p>I'm worried about my result in converting the numbers to non-decimal and comma separated. I need to achieve proper formatting and rounding the numbers to currency as you can see in the examples below. Please help me.</p>
  
  <pre><code>select sum([TRANSACTION_PRICE]) from [dw_property_detail]
  </code></pre>
  
  <p>Wrong Result: <code>520400958.9</code><br>
  Correct Result: <code>520,400,959</code></p>
  
  <pre><code>select sum(nullif([ACTUAL_SIZE],0)) from [dw_property_detail]
  </code></pre>
  
  <p>Wrong Result: <code>25595.5</code><br>
  Correct Result: <code>(25,596)</code></p>
  
  <pre><code>select (Min(TRANSACTION_PRICE/ACTUAL_SIZE)) from [dw_property_detail]
  </code></pre>
  
  <p>Wrong Result: <code>3241412.6</code><br>
  Correct Result: <code>($3,241,413)</code></p>