How to copy query results with column headers?
This post was written by namwar on August 27, 2008
Posted Under: How-To, Information, SQL Server 2005, Tips
Posted Under: How-To, Information, SQL Server 2005, Tips
It is a very common practice that sometime you need to copy the query results from SQL Server Management Studio (SSMS) results tab to excel or any other application. The problem normally we face is that it does copy column headers and you have to write the column headers by your self. Here is the quick tip to enable column headers copying.
- In SSMS, open Tools menu and click Options
- Expand Query Results node and click Results to Grid
- Check Include column headers when copying or saving the results. Your screen will look similar to following:
- Click Save to save your settings.
Now, whenever you will copy the query results, column headers will be copied too.
Enjoy!






Reader Comments
Great tip, thanks for the information.
Can’t we get these column headers thru “open table” option?
This works great with Office 2003 or excel 2003 but it does not work in excel 2007. Is there a trick to make it copy the headers to excel 2007?