Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to be able to retrieve contents from a database table or the whole database if possible, package it into a excel file and then send it to a certain email address.

I am not using any server at the moment, as I am only trying it out from my own PC. Any ideas on how it can be done?

I am using Microsoft SQL Server 2012.

Thank you in advance for the help.
Posted

1 solution

Go to your Sqlserver management studio and right click on the database.
Go to tasks and Export.(below) And export it with destination excell using the wizard.
create a package with this.

Create a databasemail profile see:

http://msdn.microsoft.com/en-us/library/ms187605%28v=sql.110%29.aspx[^]

Create an agent job with two steps.

step 1 Create the excel file using the package that you created. (Choose type SSIS Package for this step.)
step 2 Use the sp_send_dbmail stored procedure to send the email using the databasemail profile and the excell attchament.

After this schedule the job and enable it.
 
Share this answer
 
v2
Comments
Member 10915623 2-Jul-14 2:10am    
Thanks for the help, but I think I could use more help in the email configuration part such as the server name and port, the file formats and such :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900