title: Cross Tab query in SQL Server 2008
body: <p>I have a SQL table with following fields</p>
  
  <pre><code>ID, Rly, Shed, Loco_no, shed, Date_failure, Equipt
  </code></pre>
  
  <p>I am using a cross tab query in access using the following script in MS Access 2007</p>
  
  <pre><code>TRANSFORM Count(Sheet1.[sno]) AS CountOfsno
  SELECT Sheet1.[Equipt], Count(Sheet1.[sno]) AS [Total Of sno]
  FROM Sheet1
  GROUP BY Sheet1.[Equipt]
  PIVOT Sheet1.[Shed];
  </code></pre>
  
  <p>How can this query be converted to a SQL Server stored procedure for use on an aspx page?</p>
  
  <p>please help</p>