SQLServer 2000 - export query results to Excel

How to export query results from Query Analyzer Results pane to include the column headings.  Currently I am adding the column headings manually.

I know how to export without the headings:
http://www.experts-exchange.com/Database/Miscellaneous/Q_21849293.html?sfQueryTermInfo=1+pane+result+sqlserver#a16673638

thx alot experts
GeorgeJacobsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dbaSQLCommented:
Easily done via DTS to csv Transform Data Task
-Set up sql server connection, set up text file (destination), and do a transform data task between each
Within that task you can write any query you like, though ideally, you're using a procedure.
Put it in, parse it, define your transformations simply as a copy of all columns.
Double click the text file (destination), it opens a dialog box 'connection properties' --
bottom right, choose 'properties', go in there and opt file type, row and column delimiter and text qualifier.

There is also a 'First row has column names' option
Check it
And you're good to go
0
dbaSQLCommented:
oh i'm sorry.  i didn't read closely enough -- you are talking about to excel directy from query analyzer result pane.

still, this can be done

go to tools/options
generat tab:  change result file extension to .csv
results tab: change results output format to 'comma delimited (csv)'
results tab:  make sure 'print column headers' is checked

then, just exec your query just like before.  when you want a csv file as output, change the results from Grid/Text to File and run the query again.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GeorgeJacobsonAuthor Commented:
If I use DTS that means I would have to run query results into a table first (or view)?  That is, the source for DTS needs to be a table?
Thx alot dbaSQL.  (too bad SQLServer does not have a File Export feature like MSAcess!)
0
GeorgeJacobsonAuthor Commented:
Thank you very much dbaSQL (my last post was before I saw this post/solution)
0
dbaSQLCommented:
Very good, I hope everything works out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.