Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
1,171 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
[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
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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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