title: sql date parameter in query
body: <p>I've got a query and I want to add parameters to calculate the moving annual (the figures for the last 12 months).  I'm trying to subtract 12 months from today, so if for instance today is 1 August 2012 then my @StartDate should be '2011-09-01' and my @EndDate should be '2012-08-31'.  So how do I change set my parameters to accommodate this?</p>
  
  <pre><code>declare @StartDate DATE
  declare @EndDate   DATE
  SET @StartDate = DATEADD(MONTH, -12, '2012-08-01')
  SET @EndDate = DATEADD(MONTH, +1, '2012-08-01')
  </code></pre>