MS-SQL 2005 Database Mail Questions

dbirkbeck
dbirkbeck used Ask the Experts™
on
OK...here's what I want to do using SQL Server 2005 Database Mail.

I have to send 500 unique reports in excel format as attachments. Each report has it's own separate email addr. Any ideas?

Thanks,

Dave
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
How are you Creating the Excel Report Formats? There are many options for you to use depening on the way you would like to design the application. If you are looking to use Strictly SQL and not another application such as VB, C#, Crystal Reports, Sql Reporting Services etc. There is a way you could do it through SQL.
First off you will need to Create a Table to Store User/Email related Information and Any Parameters needed to create unique Report Runs.
Second I would create a Stored Procedure that would loop through each Email and then preform some data retrieval operation and then Output the results to a format such as CSV which is Excel Compatible. There are many different ways to do this. Then Attach the File to the Database mail and send it out.

If you have files for the Excel Files you could Create a table with the Email Addresses and then use DB Mail to attach the files from the File System. Depends on where and how you want to Build/retrieve the Excel files.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial