SSIS Send email to different recipients with different data from SQL Table











up vote
0
down vote

favorite












I am trying to create an SSIS Package that sends out emails to different recipients and includes some of the data as a table that is either included in the body of the email or attached as an Excel file.



I have three tables, one that includes the email addresses, one that includes the error type and the main table that contains customer information like name, old address info, and new address info all broken out into about 16 different columns, of which are codes to pull from the two other tables to determine which person to email to update the address and a code description on why they need to update it.



I have created a script task to combine the data and pass it to a foreach loop container.



I'm not sure how to take the customer info, old address and new address columns of data from what I've pulled together in the sql task (CIF_Nbr to Current_XIPplus4) and create a table from it that can be inserted into the body or added as an attachment to the send mail task.



A branch could have multiple lines of data so I would prefer one attachment for all same branches sent only once to that branch.



My three tables have the following columns:



Customer_Info table



Branch_Email table



Return_Mail_Code Table



Combined SQL Task table



I'm using Microsoft Visual Studio 2008 and SQL server 2008 if that helps. I'm pretty much stuck with the default toolbox.



Hopefully this all makes sense. I'm fairly new to visual studio so the more detail the better. Thanks.










share|improve this question
























  • Please show your table schema as a code snippet and not as screenshots.
    – jtate
    Nov 12 at 22:14










  • Here's one example of sending data in an email dba.stackexchange.com/questions/35263/… You can do what you want by repeatedly calling msdb.dbo.sp_send_dbmail. You don't even need SSIS for this.
    – Nick.McDermaid
    Nov 13 at 11:12















up vote
0
down vote

favorite












I am trying to create an SSIS Package that sends out emails to different recipients and includes some of the data as a table that is either included in the body of the email or attached as an Excel file.



I have three tables, one that includes the email addresses, one that includes the error type and the main table that contains customer information like name, old address info, and new address info all broken out into about 16 different columns, of which are codes to pull from the two other tables to determine which person to email to update the address and a code description on why they need to update it.



I have created a script task to combine the data and pass it to a foreach loop container.



I'm not sure how to take the customer info, old address and new address columns of data from what I've pulled together in the sql task (CIF_Nbr to Current_XIPplus4) and create a table from it that can be inserted into the body or added as an attachment to the send mail task.



A branch could have multiple lines of data so I would prefer one attachment for all same branches sent only once to that branch.



My three tables have the following columns:



Customer_Info table



Branch_Email table



Return_Mail_Code Table



Combined SQL Task table



I'm using Microsoft Visual Studio 2008 and SQL server 2008 if that helps. I'm pretty much stuck with the default toolbox.



Hopefully this all makes sense. I'm fairly new to visual studio so the more detail the better. Thanks.










share|improve this question
























  • Please show your table schema as a code snippet and not as screenshots.
    – jtate
    Nov 12 at 22:14










  • Here's one example of sending data in an email dba.stackexchange.com/questions/35263/… You can do what you want by repeatedly calling msdb.dbo.sp_send_dbmail. You don't even need SSIS for this.
    – Nick.McDermaid
    Nov 13 at 11:12













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to create an SSIS Package that sends out emails to different recipients and includes some of the data as a table that is either included in the body of the email or attached as an Excel file.



I have three tables, one that includes the email addresses, one that includes the error type and the main table that contains customer information like name, old address info, and new address info all broken out into about 16 different columns, of which are codes to pull from the two other tables to determine which person to email to update the address and a code description on why they need to update it.



I have created a script task to combine the data and pass it to a foreach loop container.



I'm not sure how to take the customer info, old address and new address columns of data from what I've pulled together in the sql task (CIF_Nbr to Current_XIPplus4) and create a table from it that can be inserted into the body or added as an attachment to the send mail task.



A branch could have multiple lines of data so I would prefer one attachment for all same branches sent only once to that branch.



My three tables have the following columns:



Customer_Info table



Branch_Email table



Return_Mail_Code Table



Combined SQL Task table



I'm using Microsoft Visual Studio 2008 and SQL server 2008 if that helps. I'm pretty much stuck with the default toolbox.



Hopefully this all makes sense. I'm fairly new to visual studio so the more detail the better. Thanks.










share|improve this question















I am trying to create an SSIS Package that sends out emails to different recipients and includes some of the data as a table that is either included in the body of the email or attached as an Excel file.



I have three tables, one that includes the email addresses, one that includes the error type and the main table that contains customer information like name, old address info, and new address info all broken out into about 16 different columns, of which are codes to pull from the two other tables to determine which person to email to update the address and a code description on why they need to update it.



I have created a script task to combine the data and pass it to a foreach loop container.



I'm not sure how to take the customer info, old address and new address columns of data from what I've pulled together in the sql task (CIF_Nbr to Current_XIPplus4) and create a table from it that can be inserted into the body or added as an attachment to the send mail task.



A branch could have multiple lines of data so I would prefer one attachment for all same branches sent only once to that branch.



My three tables have the following columns:



Customer_Info table



Branch_Email table



Return_Mail_Code Table



Combined SQL Task table



I'm using Microsoft Visual Studio 2008 and SQL server 2008 if that helps. I'm pretty much stuck with the default toolbox.



Hopefully this all makes sense. I'm fairly new to visual studio so the more detail the better. Thanks.







sql-server ssis






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 5:18









kenlukas

1,2221217




1,2221217










asked Nov 12 at 22:09









Shaun Rezac

1




1












  • Please show your table schema as a code snippet and not as screenshots.
    – jtate
    Nov 12 at 22:14










  • Here's one example of sending data in an email dba.stackexchange.com/questions/35263/… You can do what you want by repeatedly calling msdb.dbo.sp_send_dbmail. You don't even need SSIS for this.
    – Nick.McDermaid
    Nov 13 at 11:12


















  • Please show your table schema as a code snippet and not as screenshots.
    – jtate
    Nov 12 at 22:14










  • Here's one example of sending data in an email dba.stackexchange.com/questions/35263/… You can do what you want by repeatedly calling msdb.dbo.sp_send_dbmail. You don't even need SSIS for this.
    – Nick.McDermaid
    Nov 13 at 11:12
















Please show your table schema as a code snippet and not as screenshots.
– jtate
Nov 12 at 22:14




Please show your table schema as a code snippet and not as screenshots.
– jtate
Nov 12 at 22:14












Here's one example of sending data in an email dba.stackexchange.com/questions/35263/… You can do what you want by repeatedly calling msdb.dbo.sp_send_dbmail. You don't even need SSIS for this.
– Nick.McDermaid
Nov 13 at 11:12




Here's one example of sending data in an email dba.stackexchange.com/questions/35263/… You can do what you want by repeatedly calling msdb.dbo.sp_send_dbmail. You don't even need SSIS for this.
– Nick.McDermaid
Nov 13 at 11:12

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270820%2fssis-send-email-to-different-recipients-with-different-data-from-sql-table%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270820%2fssis-send-email-to-different-recipients-with-different-data-from-sql-table%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?