Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Query Results to Excel 1

Status
Not open for further replies.

JohnOB

Technical User
Oct 5, 2006
253
GB
I have Microsoft SQl Server 2000 and am using SQL Query Analyser version 8. When I run a query I would like to be able to export the results to an excel spreadsheet, however when I choose Execute Mode > Results To File the only file type option I have is an rpt file. I have crystal reports but it can't open the file. I have tried using 'All files' and manually typing in filename.xls which does create an excel file, but everything is contracted into row A.

Can anyone tell me if there is an option to export the query directly from SQL into Excel, either using an option in the program or as part of the SQL Query command?

Amy advice is appreciated

Thanks

John


"The only stupid question is the one that doesn't get asked
 
Pick a database in Enterprise Manager, right-click it and navigate to All Tasks -> Export Data. This will enable you to choose an Excel spreadsheet as a destination (or any destination). Follow the prompts and when you get to the "Export tables" / "Export based on a Query", choose the query option and click next, then copy-n-paste your code into the box that comes up next box. Complete the wizard and you're set.

Also, you can go to Tools -> Wizards and look for the Import / Export Wizard.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top