title: How to get calendar Quarter from a date in TSQL
body: <p>I have different dates in a column.  For example:</p>
  
  <pre><code>20080102
  20070821
  </code></pre>
  
  <p>I want to convert these dates in Year and calendar quarter.  E.g.,</p>
  
  <pre><code>Year      Quarter
  2008      2008-Q1
  2007      2007-Q3
  </code></pre>
  
  <p>I can get the first column with:</p>
  
  <pre><code>select left(date,4) as year from table 
  </code></pre>
  
  <p>How can I produce the second column?</p>