SQLServerCentral Article

Include Column Headers From SSMS

,

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.

Rate

4.65 (26)

You rated this post out of 5. Change rating

Share

Share

Rate

4.65 (26)

You rated this post out of 5. Change rating