Thursday, February 16, 2012

SQL Server and Excel: Include column headers

If you want to build a quick report from your sql results in Excel, I'd highly recommend turning an option in Management Studio (SSMS) called "Include column headers when copying or saving the results".  Dare I say it's one of those helpful options you only know about if you happened to stumble across it?

You'll find it under:
  1. [System Menu] > Tools > Options...
  2. Query Results + SQL Server + Results to Grid
  3. Check the box that says "Include column headers when copying or saving the results"

Options dialog:



Example of use:

Select from Results Grid
Select All (or Ctrl+A & Ctrl+C)

Pasting into Excel
Headers included!

No comments:

Post a Comment