Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Send Mail Task Help in SSIS
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

224 Posts

Posted - 01/14/2013 :  18:35:45  Show Profile  Reply with Quote
I have quick question.

I am using Send email task in SSIS.
I create a table On SSMS, Below is a Table Structure.

ID, SSISPackage Description, TO, FROM
2, Monthly Report,,

What I want to use To and From Informatioin from Table. If i want to add or delete someone from
From or To List i can update Table not all SSIS Package. Please guide me how i can or can i accomplish this one?

Thanks in advance.

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 01/15/2013 :  00:15:14  Show Profile  Reply with Quote
you need a for each loop for this.

First create a variable of type object in SSIS for storing resultset and two string variables for storing FROM, TO values

Use a Execute SQL task with full resultset option to populate recordset with from and to addresses. the query would be like
FROM TableName
(it can be made dynamic by putting ? place holder and mapping to @[System::PackageName] in Parameters tab

Then inside for each loop configure to make use of Recordset enumerator and map it to above created variable. Inside for each loop create map string variable to recieve TO, FROM value during each iteration.
Now add a send mail task inside it and use expression builder to map FROM and TO variable values to From and TO property of send mail task.

On executing it will populate recordset with records from table and then for each loop will extract each FROM,TO values from variable and set send mail task with their values to send mails

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000