Monday, February 13, 2012

Copy SS2005 query headers & data to Excel

Hello,
Using SS2005, is there a way to copy both the headers and the data when you
run a query and paste the results in Excel?
--
Thanks in advance,
StevenSteven K0 (stroy@.api.com) writes:
> Using SS2005, is there a way to copy both the headers and the data when
> you run a query and paste the results in Excel?
Yup! Tools->Options->Query Results->SQL Server->Results to Grid. Find
the checkbox "Include column headers when copying and saving the results".
If memory serves, headers are only copied when you select cells from at
least two columns.
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

No comments:

Post a Comment