title: Get row count including column values in sql server
body: <p>I need to get the row count of a query, and also get the query's columns in one single query. The count should be a part of the result's columns (It should be the same for all rows, since it's the total).</p>
  
  <p>for example, if I do this:
  <code>select count(1) from table</code>
  I can have the total number of rows.</p>
  
  <p>If I do this:
  <code>select a,b,c from table</code>
  I'll get the column's values for the query.</p>
  
  <p>What I need is to get the count and the columns values in one query, with a very effective way.</p>
  
  <p>For example:
  <code>select Count(1), a,b,c from table</code>
  with no group by, since I want the total.</p>
  
  <p>The only way I've found is to do a temp table (using variables), insert the query's result, then count, then returning the join of both. But if the result gets thousands of records, that wouldn't be very efficient.</p>
  
  <p>Any ideas?</p>