Solved

Exporting MS SQL results directly to Excel

Posted on 2011-03-15
5
210 Views
Last Modified: 2012-05-11
Hello,  is there a way to automatically have the results from a MS SQL query get expoerted directly to Excel?

To take it one step further I have a number of scripts that users need to have run every morning or some even just every Monday and I would like to be able to set them up so they automatically fire off and save the results to an Excel spreadsheet in a specific directory with a file name.  Is this possible in SQL?

Thanks,
John
0
Comment
Question by:JohnJMA
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:colly92002
ID: 35142984
You could use Reporting Service subscriptions:
http://msdn.microsoft.com/en-us/library/ms159762.aspx
0
 
LVL 21

Accepted Solution

by:
huslayer earned 500 total points
ID: 35156586
Yeah, SQL server can do ANYTHING!!
basically you'll just write your script using "openrowset" and run it using "SQLCMD" .

here's SQLCMD tutorial:
http://www.techrepublic.com/blog/datacenter/using-sqlcmd-to-execute-sql-scripts/422

and here's how to build your export to excel query/;
http://www.mssqltips.com/tip.asp?tip=1202

and

http://jasonhaley.com/blog/post/2004/03/06/OPENROWSET-T-SQL-function.aspx

Also can be done in joomle, using PHP; if that's what you're looking for too.
http://extensions.joomla.org/extensions/core-enhancements/data-reports/7413

Hope that helps
Jason
0
 
LVL 21

Expert Comment

by:huslayer
ID: 35285991
John,

Any Luck?
do you need more help?

Jason
0
 

Author Comment

by:JohnJMA
ID: 35290282
Hello Jason,
I have been working on it.  I don't have a solid solution for it ye.  Had something else that came up that has taken most of my time.  I am going to look at SQLCMD a little more.  I would just like a straight dump to Excel from a MS SQL stored procedure.

John
0
 

Author Closing Comment

by:JohnJMA
ID: 35793987
Thanks forthe help.  I like the build export to excel solution.  I don't want to use reporting services becasue we are using Crystal Server and I also want to have them  run a solution and go right to excel.  These are for mostly automated processes.

Thans.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now