July 25, 2008 at 9:24 am
Hello...
I want to use an Execute SQL Task to load an email address list from a table
and use the variable as the TO field in the Send Mail Task.
How to get the list into a variable ?
how to make it work as the TO in Send Mail. Any ideas?
Thanks
Thanks [/font]
July 25, 2008 at 9:48 am
Use a For Each Loop Container to iterate over the rows in your variable and put the Send Mail Task into the For Each Loop. In the Execute SQL Task you would set your resultset option to Full ResultSet. Then on the Result Set tab Add new Result and name it 0 and create new variable of type Object (EmailAddresses). Then in the For Each Loop Container Properties go to the Collection Tab and set the Enumerator to Foreach ADO Enumerator and in the lower section set the Ado Object Source variable to the EmailAddresses variable you created in the Exec SQL Task. Then on the variable mapping tab create a new EmailAddress Variable of type string that maps to index 0. Now you can use the EmailAddress variable in the Send Mail Task
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
July 25, 2008 at 1:44 pm
Thanks Jack, It Works Fine Now...:)
Thanks [/font]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply