title: T-SQL Count days between two days (datediff not quite working)
body: <p>We have a requirement to bill our customers per day. We bill for an asset's existence in our system <i>on that day</i>. So, I started with datediff...</p>
  
  <pre><code>select datediff(dd  ,'2015-04-24 12:59:32.050'  ,'2015-05-01 00:59:59.000');
  </code></pre>
  
  <p>Returns this:</p>
  
  <pre><code>7
  </code></pre>
  
  <p>But I need to count the following dates: 4/24,4/25,4/26,4/27,4/28,4/29, 4/30, 5/1, which are 8 days. So datediff isn't quite working right. I tried these variations below</p>
  
  <pre><code>--too simple, returns 7, i need it to return 8
  select datediff(dd  ,'2015-04-24 12:59:32.050', '2015-05-01 23:59:59.000');
  
  --looking better, this returns the 8 i need
  select ceiling(datediff(hh,'2015-04-24 12:59:32.050', '2015-05-01 23:59:59.000')/24.0);
  
  -- returns 7, even though the answer still needs to be 8. (changed enddate)
  select ceiling(datediff(hh,'2015-04-24 12:59:32.050', '2015-05-01 00:59:59.000')/24.0);
  </code></pre>
  
  <p>So, my question... How, in SQL, would I derive the date count like i described, since I believe datediff counts the number of day boundaries crossed.... My current best approach is loop through each day in a cursor and count. Ick.</p>