Export to excel from SQL Server 2000 using Query Analyzer code

cindi picture cindi · Sep 22, 2010 · Viewed 9.2k times · Source

What's the easiest way to export data to excel from SQL Server 2000.

I want to do this from commands I can type into query analyzer.

I want the column names to appear in row 1.

Answer

Joe Stefanelli picture Joe Stefanelli · Sep 22, 2010

In Query Analyzer, go to the Tools -> Options menu. On the Results tab, choose to send your output to a CSV file and select the "Print column headers" option. The CSV will open in Excel and you can then save it as a .XLS/.XLSX

alt text