send email through a stored procedure using values from table
Hello, Not sure where my question should be in sql or SSIS forum. i have a table like.. source type importfilepath exportfilepath BOM 1 c:\import\BOM\BOM.xls c:\export\BOM\BOM.xls RTM 1 c:\import\RTM\RTM.xls c:\export\RTM\RTM.xls GSM 2 c:\import\GSM\GSM.xls c:\exmport\GSM\GSM.xls i want to use a stored procedure which would send an email attaching the file from the location in table column exportfilepath. I have an SSIS package with the 3 variables iBom, iRtm, iGsm and these variables would have values either 1 or 0, 1 or 0 and 2 or 0 respectively. so depending on those values i want to send file when BOM, RTM and GSM have 1,1 and 2 resp. from table above. can somebody tell me how do i write a script for that which would decide which source is valid and then pass the values from table and send email including the file. I already have the stored procedure to send email with file attachment for 3 sources but can i do that just in one script?
May 15th, 2012 9:43pm

I would approach this like follows: Create an Execute SQL Task to get the data from the table and then pass its result as full resultset to a package variable. Then shred it in a ForLooop processing each row and passing the needed values to a parametrized SendMail Task (for attachment). See how you can shred the recordset: http://www.sqlis.com/post/Shredding-a-Recordset.aspx This way you do not need to script too much.Arthur My Blog
Free Windows Admin Tool Kit Click here and download it now
May 16th, 2012 9:44am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics