title: SQL first of every month
body: <p>Supposing that I wanted to write table valued function in SQL that returns a table with the first day of every month between the argument dates, what is the simplest way to do this?  </p>
  
  <p>For example <code>fnFirstOfMonths('10/31/10', '2/17/11')</code> would return a one-column table with <code>11/1/10, 12/1/10, 1/1/11</code>, and <code>2/1/11</code> as the elements.  </p>
  
  <p>My first instinct is just to use a while loop and repeatedly insert first days of months until I get to before the start date. It seems like there should be a more elegant way to do this though.  </p>
  
  <p>Thanks for any help you can provide.</p>