SSIS - Concantenate multiple error msgs into one and send email
Hi All,
This is my issue:
I have a ForLoop container with a ftp task and a send mail task. It dowloads files from ftp site and if any of the files fail to download i send email with the file name.
Since im downloading multiple files this sends multiple emails for multiple failed downloads. I need to modify and send one email with all the files that failed instead of one for each. The thing is i have one variable that holds the filename for the failed
file download. In the for loop this is populated with each file that fails. So dont knw how to capture all the failed filenames? Can i create another variable to concatenate the filename variable??
Can i use script task? If i can please provide examples am not good with vb coding.
Any help appreciated!
May 19th, 2011 10:00am
My suggestion is to wirte the list into a tbal or a txt file , so that you have the history of what has happend and then email the list
you can still use one variable if you are going to save it into a file or table, concatting , I am not a fan , because you dont have any history.
you dont need a vb code
use a SMTP object and attache the file to it (make it simple).
try to have a history folder (if ou are savinh in files) or a field in a table that has todays date , to keep track of the files
Sincerely SH -- MVP, MCITP 2008, MCTS 2008 & 2005 -- Please kindly mark the post(s) that answered your question and/or vote for the post(s).
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2011 10:19am
Hi,
Just create another STRING Variable to hold all the file names.
and add a script task inside the "For Each Loop" just to append the name to the newly created String Variable.
"StrVarName" is the regular variable you're using , "StrVarAllNames" is the one with all the names.
add this code to the script task
Dim StrName As String = ""
StrName = Dts.Variables("StrVarName").Value
If StrName.Length <= 0 Then
Dts.Variables("StrVarAllNames").Value = Dts.Variables("StrVarAllNames").Value
ElseIf StrName.Length > 0 Then
Dts.Variables("StrVarAllNames").Value = Dts.Variables("StrVarAllNames").Value + "," + StrName
End If
and use "StrVarAllNames" in your E-mail.
MCITP - BI 2008 http://asqlb.blogspot.com/
May 19th, 2011 11:22am
Thank you both this was very helpful! Appreciate the help
You're welcome, so what did you end up with?
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2011 6:42pm
Thank you both this was very helpful! Appreciate the help
May 19th, 2011 6:43pm
Thank you both this was very helpful! Appreciate the help
You;re welcome, so what did you end up with?MCITP - BI 2008 http://asqlb.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2011 6:45pm