Click here to Skip to main content
15,116,813 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)

I want to create SSIS package of Send Mail Task.
This task already has a File System Task which generates an excel sheet everyday based on current date.
And this task also already has a Data Flow Task which transfers data from database to exel sheet.

The problem is all the generated excel sheets are in a particular folder and the latest excel sheet needs to be sent to a a group of people as an attachmnt.How to do that?
When i go to Properties of Send Mail Task there is an option of Attachments but how to make it a dynamic one?

These tasks needs to be run through SQL Server Agent Jobs.

Only attachment part is left.The rest has been completed

1 solution

you can use the send mail task and pass the file name dynamically through expression to task and schedule it as per your requirments.

For example, if you want to attach files, "d:\Data_20070119.xls", use this expression in SendMail Task


"D:\\" + "Data_" + REPLACE(SUBSTRING((DT_WSTR, 50) GETDATE(), 1, 10), "-","") + ".xls"

you should use "\\" instead of "\"..

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