title: Add a row for every day between two dates with number of hours in SQL Server
body: <p>Starting data:</p>
  
  <p><a href="https://i.stack.imgur.com/vIsif.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vIsif.png" alt="enter image description here"></a></p>
  
  <p>Desired results something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/qZW4T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qZW4T.png" alt="enter image description here"></a></p>
  
  <p>So it calculated the number of hours until the end of StartDateTime, if the EndDateTime is greater than end of day for StartDateTime. Then for every full day in between, it calculates 24 hours (this could stretch numerous days). And then when it gets to the EndDateTime - it calculates time from midnight (morning) to EndDateTime</p>
  
  <p>I'm reading that I will probably need to use a recursive CTE, but I don't have any experience with recursions and am struggling.</p>