Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Exporting Ad Hoc queries to Excel

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-19 : 12:46:20
Kevin writes "Please forgive me if this is a stupid question. I am working in an environment where we are using SQL Server 2005 and Excel 2003. We have a custom .NET 2005 application which runs against the SQL Server. Users frequently create ad hoc queries in Management Studio to pluck out certain info. They would like to save the results down into an Excel spreadsheet for further analysis; However, we haven't come up with an elegant solution to save these results in Excel and keep the column headings and data types for each column. I have seen transact-sql code to do this in the past using the OPENROWSET command to write to an Excel file; However, I am not confident that this is the best way to skin this particular cat so I thought I would run it by you. So, my question is, What is the BEST way to save ad hoc query results from SQL Server to an Excel spreadsheet so that I preserve the column headings and data type of each column?"

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-02-19 : 13:42:19
They could use the SQL Server Import and Export Wizard.



CODO ERGO SUM
Go to Top of Page

dpoirier
Starting Member

9 Posts

Posted - 2009-10-14 : 22:51:18
You probably gave up on this about 2 years ago, BUT - I've written an SSMS addin to do exactly what you're after -

http://www.SsmsXlsExport.com/

Cheers,
David
Go to Top of Page
   

- Advertisement -