Thursday, January 08, 2009

Cut-and-Paste from Grid-Mode Output in SSMS

If you've ever cut-and-pasted output from the grid-mode output of SSMS to Excel, you've probably had to insert a row above the results and type in the column headings.

Well, you can get SSMS to include those headings in the cut-and-paste output.

Go to Tools, Options, Query Results, SQL Server, Results to Grid. Check "Include column headers when copying or saving the results".
Without that set, copying this from SSMS
and pasting it into Excel gives you this:
With it set, you get this:
Much better.

(Thanks to Roman Rehak's tip in SQL Server Magazine.)

1 comment: