Solved

Exporting MS SQL results directly to Excel

Posted on 2011-03-15
5
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:
Jason Yousef, MS 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:Jason Yousef, MS
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

631 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