使用数据库插入触发器发布报表 [英] Use Database Insert Trigger to Publish Reports

查看:50
本文介绍了使用数据库插入触发器发布报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 SQL Server 2008 R2 的标准版基于数据库插入触发器分发报告?触发器将寻找具有特定值的特定列,这将表明是时候触发报告了.这不会经常发生,可能一天发生几次.

Is it possible to distribute reports based on a database insert trigger, using the standard edition of SQL Server 2008 R2? The trigger will be looking for a certain column to have a certain value, which will indicate that it is time to fire off a report. This will not happen very often, probably a couple of times a day.

这一定是一个常见的场景,但我找不到任何关于它的信息,这一定意味着我问错了问题.(我对 SQL Server 完全陌生.)

This must be a common scenario, and yet I can't find any information on it, which must mean that I'm asking the wrong question. (I am completely new to SQL Server.)

使用 FireEvent 的 TSQL?

TSQL using FireEvent?

谢谢,
迈克

推荐答案

是否有任何厌恶检查应用程序中的值,然后使用 报表执行网络服务?我不喜欢数据库触发器启动外部进程的想法.太多笨重的配置依赖项和失败的机会.

Is there any aversion to checking for the value in the application, then execute and deliver the report from there using the report execution webservice? I don't like the idea of database triggers kicking off external processes. Too many clunky configuration dependencies and opportunities for failure for my taste.

如果你真的想追求这个,这似乎是最简单的方式(它需要报告服务和应用程序数据库在同一个实例上):

If you really want to pursue this, this seems to be least complicated way (it requires reporting services and application database to on same instance):

  • 创建以所需格式提供报告的报告服务订阅
  • 打开 SQL Server 代理作业列表并获取与创建的订阅相对应的作业名称的唯一标识符(您必须查看作业创建和上次/下一次运行日期时间才能找到与您的作业相关的作业)订阅)
  • 创建执行 msdb.dbo.sp_start_job 过程的触发器,传递与您的订阅匹配的作业名称
  • Create reporting services subscription that delivers report in desired format
  • Open the SQL Server agent job list and get the unique identifier of the job name that corresponds to the subscription that was created (you'll have to look at job creation and last/next run datetime to find which job relates to your subscription)
  • Create trigger that executes the msdb.dbo.sp_start_job procedure, passing the job name that matches your subscription

明白我对笨重依赖的意思吗?如果可能的话,我肯定会坚持检查值并在应用层提交报告.

See what I mean about clunky dependencies? I would definitely stick with checking values and delivering the report in the application layer if at all possible.

这篇关于使用数据库插入触发器发布报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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