通过SSIS包发送邮件任务 [英] Send Mail Task through SSIS Package

查看:161
本文介绍了通过SSIS包发送邮件任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想创建发送邮件任务的SSIS包。

此任务已经有一个文件系统任务生成每天基于当前日期的Excel表格。

此任务还有一个数据流任务,它将数据从数据库传输到exel表。







问题是所有生成的Excel工作表都在特定的文件夹中,最新的Excel工作表需要作为附件发送给一群人。如何要做到这一点?

当我去发送邮件任务的属性时,有一个附件选项,但如何使它成为一个动态的?



这些任务需要通过SQL Server代理作业运行。



只剩下附件部分。其余部分已经完成

Hi,

I want to create SSIS package of Send Mail Task.
This task already has a File System Task which generates an excel sheet everyday based on current date.
And this task also already has a Data Flow Task which transfers data from database to exel sheet.



The problem is all the generated excel sheets are in a particular folder and the latest excel sheet needs to be sent to a a group of people as an attachmnt.How to do that?
When i go to Properties of Send Mail Task there is an option of Attachments but how to make it a dynamic one?

These tasks needs to be run through SQL Server Agent Jobs.

Only attachment part is left.The rest has been completed

推荐答案

您可以使用发送邮件任务并通过表达式动态传递文件名到任务,并根据您的要求安排它。



例如,如果要附加文件d:\Data_20070119.xls,请在SendMail任务中使用此表达式



FileAttachMent



you can use the send mail task and pass the file name dynamically through expression to task and schedule it as per your requirments.

For example, if you want to attach files, "d:\Data_20070119.xls", use this expression in SendMail Task

FileAttachMent

"D:\\" + "Data_" + REPLACE(SUBSTRING((DT_WSTR, 50) GETDATE(), 1, 10), "-","") + ".xls"





您应该使用\\而不是\..



you should use "\\" instead of "\"..


这篇关于通过SSIS包发送邮件任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆