Home > Management Studio, SQLServer > SQL Server – Copy Results with Headers – Management Studio

SQL Server – Copy Results with Headers – Management Studio


SSMS allows you copy query results with column headers. However, if you copy results by choosing "Copy" or Ctrl + C, by default it does not copy headers.

Management Studio 2008 allows you to copy data with headers by choosing "Copy with Headers" from Edit or Context Menu (or Ctrl + Shift + C).

Context Menu in 2008

image

However, for Management Studio 2005 no such shortcut is available:

Context Menu in 2005:

image 

 

You can set "Copy with Headers" as *default* from SSMS options:

This can be done in both SSMS 2005 and 2008.

1. Go to "Tools" –> "Options"

2. Expand "Query Results" –> "SQL Server" –> "Results to Grid"

3. Check "Include column headers when copying or saving the results"

image

4. Click "OK".

Note: Changes will take effect in new query windows only.

This will enable copying headers with *simple* copy (Ctrl + C).

 

Hope This Helps!

Vishal

  1. Doug Jacobsen
    09.12.2011 09:56 | #1

    This works too well for me. I’m unable to copy results WITHOUT headers. I have unchecked this option in the settings and select only Copy from the context menu. I still get the headers no matter what process I use (menu, keyboard) to copy and paste. Any thoughts on how to fix this are welcome.

  2. Vishal
    12.12.2011 09:45 | #2

    Hi Doug,

    The only reason I can think of is; When you uncheck this option in settings, the new settings does not take effect in current query window.

    Launch a new query window after changing the setting and try from there.

  3. Ronny
    27.07.2012 09:14 | #3

    The problem is with the “Select ” context menu entry on tables. It opens a new result view with the option to copy headers always enabled, even though you disabled it and it is off in new queries opened by yourself.

  1. No trackbacks yet.