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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Route output to an excel sheet

Status
Not open for further replies.

vaidyanathanpc

Programmer
Nov 30, 2001
36
0
0
IN
Hi,
I want to route the output of a query to an excel sheet. How do I do this?
I have a query..

Select column1, column2, column3
from table1

I want to route the o/p of this query to an excel sheet.

Thanks
P.C. Vaidyanathan
 
Two ways I can think of, although I'm sure there are others:

1. Create an ODBC data source that points to your SQL Server instance and then use the Excel 'Get Data' option.

2. Create a linked server in SQL Server pointing to your spreadsheet and then use an 'insert into select from' SQL statement where you insert into the linked server.
 
Heres a couple more ways.

3. Use DTS to output to Excel

4. In Query Analyzer change Tools..Options..Results to results to file, and comma-delimited. Then you can load this file into Excel. (Quick and simple for one-offs)
 
Or even quicker, press Ctrl + D to get grid output and cut & paste results into excel!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top