Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 3056 | Views in the last 30 days: 2
 
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

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones