Archive

Posts Tagged ‘result headers’

SQL Server – Copy Results with Headers – Management Studio

16.08.2011 3 comments

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