Thursday, December 10, 2009

Sending emails to Email-ids from a SQL table using SSIS


Step 1: Add a ADO.Net connection manager. Select your server and table.
Step 2: Add a object variable and name it whatever you want. Let us say Email_Variable. Make sure the data type is "Object".
Step 3: Add a Data flow task.
Step 4: Inside the dataflow task, add a data reader source


Step 5: Select connection manager as ADO.NET Connection manager which we created before.


Step 6: in the component properties of data reader dialog box, under the sqlcommand property give the SQL command to get the email-ids.


Step 7: Add a Record set destination now. Under the component properties of recordset destination give the variable name as Email_Variable (You can give whatever you want)


Step 8: Now we have all the email-ids in the object variable Email_Variable. So we can use Foreachloop container to fetch one at a time. In the foreachloop container, under collection option select Foreach ADO Enumerator and give the variable as Email_Variable


Step 9: Now under variable mappings, create a new string variable and select it. This variable stores one email-id at a time.


Step 10: Self explanatory.... check out the screen shots