Wednesday, March 21, 2012

Exported queries to excel an spreadsheet file

Is it possible to export the results of a query using SQL Server query
manager to an excel spreadsheet file.

Thanks in advance.Hi

This depends on what you are actully wanting to do!!
If you are using Query Analyser in grid mode then you can select the whole
result set and cut/paste them into excel. Utilities like BCP can create
comma separated files which excel will open, or possibly you could go
through the XML route. DTS can also be used to do this and may be the most
suitable if you wish to automate the process.

Excel files can be created as a linked server and data pumped into them.

John

"kjc" <ksitron@.elp.rr.com> wrote in message
news:QdJsd.75465$g21.19155@.fe1.texas.rr.com...
> Is it possible to export the results of a query using SQL Server query
> manager to an excel spreadsheet file.
>
> Thanks in advance.|||John Bell (jbellnewsposts@.hotmail.com) writes:
> If you are using Query Analyser in grid mode then you can select the whole
> result set and cut/paste them into excel.

And if you want the column headers as well, go with Text mode, and under
Tools->Options change the delimiter to tab. Then run query, cut and paste.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

No comments:

Post a Comment