What I am trying to do is email from SSIS one dynamically changing text file and one excel file at
the same time.
In my SSIS package I have declared four variables:
@PoFlatFile, string, values =*.txt
@PoFlatFilePAth, string, values = d:\xxxx\yyyy\abcd
@POSQLFile, string, values = sql.xlsx
@POSELFilePath, string, values = D:\ssss\cvcd\aaaa
My flat file connection uses the expression 'connection string' @PoFlatFile. Then I have data flow task to load the SQL file from the table. Then to a ForEach Loop container, to try find the dynamic flat file.
Loop:
Folder:d:\xxxx\yyyy\abcd (same @PoFlatFilePath)
Files: *.txt
Retrieve file name: full qualified
Variable Mappings: @PoFlatFile
Within Loop there is a execute sql task.
SET NOCOUNT ON
EXEC msdb.dbo.sp_send_dbmail
@recipients='harry.jones@something.com',
@subject ='Data Check' ,
@body = 'See attachments',
@body_format = 'HTML',
@file_attachments ='@POFlatFile;@POSQLFile'
So you can see I am trying to attach two variables for each file and email them. I was originally trying to use the expression builder in a send email task, but apparently you can't have two attachments in a expression.
Can anyone tell help me with this send dbmail or suggest another way to do it?
Thanks
In my SSIS package I have declared four variables:
@PoFlatFile, string, values =*.txt
@PoFlatFilePAth, string, values = d:\xxxx\yyyy\abcd
@POSQLFile, string, values = sql.xlsx
@POSELFilePath, string, values = D:\ssss\cvcd\aaaa
My flat file connection uses the expression 'connection string' @PoFlatFile. Then I have data flow task to load the SQL file from the table. Then to a ForEach Loop container, to try find the dynamic flat file.
Loop:
Folder:d:\xxxx\yyyy\abcd (same @PoFlatFilePath)
Files: *.txt
Retrieve file name: full qualified
Variable Mappings: @PoFlatFile
Within Loop there is a execute sql task.
SET NOCOUNT ON
EXEC msdb.dbo.sp_send_dbmail
@recipients='harry.jones@something.com',
@subject ='Data Check' ,
@body = 'See attachments',
@body_format = 'HTML',
@file_attachments ='@POFlatFile;@POSQLFile'
So you can see I am trying to attach two variables for each file and email them. I was originally trying to use the expression builder in a send email task, but apparently you can't have two attachments in a expression.
Can anyone tell help me with this send dbmail or suggest another way to do it?
Thanks