Solved

How to Generate CSV file from SQL server tables and send it by email  to recipients in an automated process

Posted on 2010-11-11
3
1,117 Views
Last Modified: 2012-05-10
I have to generate a report using two tables in SQL server 2008 and send it in CSV format to recipients.
 I have already written the query(Thats Okay) . How can I use reporting services ,SSRS to do this automatically . That is send the CSV file to email automatically everyday.
or SSIS or what other process can I use to do this and automate the whole process to go everyday.

Pls can you outline the steps very well and processes I should use.if there are little code involved too, pls let me have it.

0
Comment
Question by:marvo2010
3 Comments
 
LVL 9

Expert Comment

by:radcaesar
ID: 34109719
Use BCP
Create a folder and place the file there.
Use Database mail to send mail with attachment. Below the reference

http://blogs.msdn.com/b/sqlagent/archive/2010/11/10/sql-database-mail-send-emails-with-attachment.aspx

Use a batch file to achieve the above steps. And schedule the batch file if needed.

Note; Use SQLCMD.exe to run sql scripts inside batch file.
0
 
LVL 15

Accepted Solution

by:
AmmarR earned 500 total points
ID: 34109738
Use SSIS and create a package to export to csv and email and schedule a job to run it daily

using SSIS to export to csv
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/DTS/Q_24002244.html

using SSIS to send email
http://www.mssqltips.com/tip.asp?tip=1731
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 34110039
Hi,

Export data using the "BCP" and send mail using db_sendmail SP.

else

best way to Create SSIS packages.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction In the following article I’ll be discussing and demonstrating several different ways of how images can be put on a report. I’m using SQL Server Reporting Services 2008 R2 CTP, more precisely version 10.50.1352.12, but the methods ex…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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