导出和通过电子邮件发送结果集 [英] Export and email sp result set

查看:147
本文介绍了导出和通过电子邮件发送结果集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个存储过程,该存储过程由报表调用以产生结果集.它带有2个日期参数(通常两个日期相同,并且是前一天的日期).

我想创建某种作业,以昨天的日期调用存储过程,将结果集导出为CSV格式,然后将其通过电子邮件发送给收件人列表.该作业必须每天运行.

完成此操作的首选或推荐方法是什么(SQL作业,Win Service,其他)?

预先感谢,
Genaro

Hi Everyone,

I have a stored procedure that is invoked by a report to produce a result set. It takes in 2 date parameters (normally both dates are the same and are that of the day before).

I would like to create some kind of job that invokes the stored procedure with yesterday''s date, exports the result set to CSV format and emails it to a list of recipients. The job must run daily.

What is the preferred or recommended way to accomplish this (SQL Job, Win Service, Other)?

Thanks in advance,
Genaro

推荐答案

我的建议是使用SSIS作业.我用它们来执行许多这样的功能.这是一项数据报告任务,我一直希望尽可能在数据库上保留数据任务.
My suggestion would be to use an SSIS job. I use them to perform many functions like this. This is a data reporting task and I always like to leave data tasks on the db when possible.


其他方法可能是在服务器上运行 windows服务在定义的时间间隔后将被激活.它将提取数据,创建报告并通过电子邮件发送.
Other way could be to run a windows service on the server that will be activated after defined interval. It will pull in the data, create the report and email it.


这篇关于导出和通过电子邮件发送结果集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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