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

Ouputting the query to excel SQL Server 2000

Status
Not open for further replies.

loschiavoj

Programmer
Dec 28, 2000
23
US
How can I output a query to an excel spread sheet?
Ex. select * from table_name
output to "c:\filename"
 
if it was me, I would go the other way...

go to Excel and create an external data source (your db) and put in whatever query you want. when you run it the data will be imported to the excel spreadsheet.

Paul
 
This is easy.
2 methods

Method #1 Assumes access to Enterprise Manager
Open Enterprise Mangler (aka Enterprise Manager)
Select your Server and database in tree view.

Double click tables.
Select your table to export and right click.

Choose export data from pop up menu.
A window asking for a datasource will present itself.
Data source is MS SQL Server.
Next it will ask for a data destination.

You can select xls file from drop down.


method #2
Just bcp data out and import in as a text file
At command prompt just type bcp press enter you will get a list of parameters
ex
bcp Pubs.dbo.author out authors_data.txt -c -Ulogin_name -SMyServerName


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top