Copying Headers from SQL Query Window results in SQL 2005

  • I wanted to copy the headers of a query result to a excel spreadsheet. In the grid view mode, by default the query editor only allows the results to be copied.

    Most of the suggested approaches indicated to change the "Default destination for results" value to "results mode to text". This mode enables the column headers by default. The columns seperated by a tab, which can be copied to csv/excel. We can switch back to grid mode after doing this.

    Though this works, there is much more simpler approach which retains the grid mode as well as copy the column headers. No need of switching between modes.

    On the SQL query analyzer menu>>>Query Options>>Results---Grid pane, please select the check box, for "Include Column headers when copying or saving the results". This option enables the setting to copy headers always.

  • Thank you for sharing !

    Many people didn't find this setting.:ermm:

    With sql2008 that option is included with the right-click on the grid. :w00t:

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Perfect. Thanks!

  • Good tip...I always right clicked on the results pane and selected copy with headers.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply