title: How to create new rows for each month within a date range?
body: <p>I need to create a view that creates new rows for each month between a date range.
  A sample of the data for my booking table is shown below.</p>
  <pre class="lang-none prettyprint-override"><code>Booking ID  Booking Name   Start Date  End Date    Booked Days
  1           HolidayUSA     1/01/2020   15/02/2020  46
  2           HolidayEurope  20/01/2020  10/03/2020  50
  3           HolidayUK      14/03/2020  19/03/2020  5
  </code></pre>
  <p>I want to create a view that will add a new record for each month between the date range, calculate the number of booked days based off the days for that month, and add month/year fields.</p>
  <p><strong>Expected output:</strong></p>
  <p><a href="https://i.stack.imgur.com/0T0gx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0T0gx.png" alt="Expected output table" /></a></p>
  <p>I’m using Microsoft SQL Server.
  Any help would be greatly appreciated.</p>