title: Select between two months
body: <p>I'm trying to write a select query where my OrderDate is between two months.
  this is my code so far.</p>
  
  <pre><code>declare @FromMonth datetime
  declare @ToMonth datetime
  set @FromMonth = '20111201'
  set @ToMonth = '20120301'
  
  select *
  from Order o
  where o.OrderDate between @FromMonth and @ToMonth
  </code></pre>
  
  <p>This almost works, except that it also looks at the day of month, meaning in this example that it won't select all the days' in my @ToMonth</p>
  
  <p>I'm using Sql Server 2012</p>
  
  <p>EDIT</p>
  
  <p>Just to make it more clear, I don't wanna trust my @FromMonth and @ToMonth input to know the last day in the month. The above is just a sample to illustrate my problem.</p>