title: How can I round a column in a single SQL request without changing the overall sum?
body: <p>I've got a table defined like this : </p>
  
  <pre><code>create table #tbFoo
  (bar float)
  </code></pre>
  
  <p>And I'm looking for a way to round every value contained in column bar without changing the total sum (which is known to be an integer, or very close to an integer because of float number precision).</p>
  
  <p>Rounding every value to the nearest integer won't work (ex : 1,5;1,5 will be rounded to 1;1 or 2;2)</p>
  
  <p>It's quite easy to do this using several requests (eg storing the original sum, rounding, computing the new sum, and updating as many rows as needed to go back to the original sum), but this is not a very elegant solution.</p>
  
  <p>Is there a way to do this using a single SQL request?</p>
  
  <hr>
  
  <p>I'm using SQL Server 2008, so solutions taking advantage of this specific vendor are welcome.</p>
  
  <hr>
  
  <p>Edit : I'm looking for a request minimizing the differences between the old values and the new ones. In other words, a value should never be rounded up if a greater value has been rounded down, and vice-versa</p>