Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Include Column Headers From SSMS

By Ken Simmons,

I used to be able to select columns in Enterprise Manager and copy the results to an Excel spreadsheet and it would include the headers. When I did the same thing in SQL Server Management Studio the headers did not copy. I write a lot of ad hoc queries and copy the results to Excel. Now I was having to type the headers and this was causing me a lot of extra work.

I accidentally stumbled across the option one day when I was trying to remove the column headers in the text results. The functionality does exist in SQL 2005, but it is not enabled by default.

First navigate to the Tools->Options menu in SSMS.
Under the Query Results->SQL Server->Results to Grid you will see an option to "Include column headers when copying or saving the results".

 

Select the option and click OK. You will then have to open a new query editor window for the changes to apply.

 

Now you can copy and paste the results and the headers will be included.

 

Conclusion

There are several options that are configurable in SSMS. If you think you are missing functionality that existed in older versions, the options are a good place to start. If you look around, you will find some very useful new features.

 
Total article views: 3063 | Views in the last 30 days: 3
 
Related Articles
FORUM

Copying Headers from SQL Query Window results in SQL 2005

SQL Query results Headers

FORUM

Retrieve column headers for INFORMATION_SCHEMA

Get INFORMATION_SCHEMA column headers

FORUM

Remove repeated column header

Remove repeated column header

FORUM

Dynamic Column Header

Dynamic Column Header with Date

ARTICLE

Covering Index using Included Columns

This article from Josef Richberg details the benefits of included columns for use in creating a cove...

 
Contribute