SQL SERVER – Copy Column Headers in Query Analyzers in Result Set

Copy Column Headers in Query Analyzers in Result Set.

In Query Analyzer go to Menu >> Tools >> Options >> Results
Select Default results Target: Results to Text
Results output format:(*): Tab Delimited
Print column headers(*): Checkbox ON(check)

[youtube=http://www.youtube.com/watch?v=BL5GO-jH3HA]

Reference : Pinal Dave (https://blog.sqlauthority.com)

Best Practices
Previous Post
SQLAuthority.com 100th Post – Gratitude Note to Readers
Next Post
SQL SERVER – User Defined Functions (UDF) to Reverse String – UDF_ReverseString

Related Posts

17 Comments. Leave new

  • It worked Fine!!!! Thanks A lot.
    Saludos desde Panama

    Reply
  • Jon-Paul Lenczuk
    August 8, 2008 2:42 am

    This worked for me like a charm! I was wondering how to do that without having to manually type the headings in Excel! Thanks!

    Reply
  • Thank you a lot!!!

    Reply
  • Parmod Bhardwaj
    April 9, 2009 4:45 pm

    Do we have any other option beside this ?

    Reply must be appriciated !

    Thanks !

    Parmod Bhardwaj

    Reply
  • Thank you!

    Searched for this option since a long time. Drives you crazy!

    regards Florian

    Reply
  • This is a great tip!!! I was searcning this very long time. Thanks

    Reply
  • Marvelous mapurazi
    July 22, 2009 9:38 pm

    thanks a span buddie-it worked wonders for couldnt take the typing no more worse off for large queries

    Reply
  • THanks a lot !! I got this site after a lot of effort, the TIP worked just as desired. WOuld recommend this to everyone !!

    Reply
  • Excellent info — thank you very much! Mr. Dave, you are the man!!

    Reply
  • Thanks alot!!! well i should be knowing that.. but anyways better late than never.

    Reply
  • Ah, so that’s how it’s done – good tip, thanks.

    Reply
  • Thanks Mr. Dave.
    This is coimgn as a real help to me.
    Keep up the great work. :-)

    Reply
  • a: thanks, I can’t tell you how many times I looked for this, and I never noticed that I can change the format of the output.

    b: just a note if you have any numbers with leading zeros in the data (some zipcodes, etc): if you save the file with a csv extension excel will open it and drop the zeros, if you save it as .txt and then open it in excel you will get a text import wizard, the wizard will allow you to set that column as text so it comes in correctly.

    Reply
  • Thanx a lot….

    Reply
  • Thanks a lot ,real help to me.

    Reply
  • Thx…Really Appreciated

    Reply
  • Rubens Guifarro
    August 3, 2016 2:05 am

    You can also do this by going to Tools/Options/Result/Query Results/Results to Grid. Check Include column headers when copying or saving results.

    Run your query in Grid mode
    Select all records by clicking the top left corner of the grid and then right click and click on “Copy with headers”

    I find this easier since I always like my query results in grid view. Also because by pasting the results from text results in having all the column names on the same cell

    Reply

Leave a Reply