The problem I've been having with this is that the column names (headers) aren't copied with the query results. This means I've been manually typing the column names in for my results. Not that big a deal when there is only a few columns included in my resultset, but when I need to report on 20-30 or so fields. What a waste of time!


I've tried sending the query results to "Text", as opposed to the "Grid", but that doesn't seem to make it much easier on me. After some poking around, I found the "Include column headers when copying or saving the results" option. It's located here:
Tools > Options
Query Results > SQL Server > Results to Grid

With this option selected, I can now copy (or directly save) data from my query results (in Grid) and have the column headers included saving me the effort of typing the column names in for each resultset I need to provide.

As you might have picked up on from the screenshots, I experience this in SSMS 2005 with basically the default settings. I don't have a SQL Server 2008 box readily available to see if this option is still unselected by default, but I sure hope it isn't. I know, going forward, this will be one of the first defaults to be switched on any SSMS installations I own.








9 comments:
Excellent info. I had a workaround that exported the data to Access then to excel which was wasted time. I just sent this to my team and it is much appreciated.
Many thanks. I just looked for how to do this and you popped up. Very timely.
Is there a SET command for this option? I need to turn it on and off for different queries.
Your solution is very much appreciated! and will save me a lot of typing time from now on.
many thanks
Nice info..will help a lot.
Thank you very much.
This has bugged my for ages. Thanks for the tip!
That's wonderful, really helpful
Thanks a lot, this was realy helpful!!
Post a Comment