SQL Server – Copy Results with Headers – Management Studio

Send Us a Sign! (Contact Us!)
--> (Word) --> (PDF) --> (Epub) --> (Text)
--> (XML) --> (OpenOffice) --> (XPS)

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



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

Context Menu in 2005:



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"



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!

SOURCE

LINK (sqlandme.com)

LANGUAGE
ENGLISH