我们如何根据时基更新触发器 [英] How We can update trigger with time base

查看:83
本文介绍了我们如何根据时基更新触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更新具有时基的触发器?
我想在将数据插入表中半小时后更新触发器.

How we can update trigger with time base?
I want to update trigger after half hour when data inserted into table.

推荐答案

触发器立即触发.我认为您可以在SQL Server中触发.NET代码,这是我看到的在其中启动计时器的唯一方法.
A trigger fires right away. I think you can fire .NET code in SQL Server, that''s the only way I can see for you to start a timer in there.


如上所述,您无法进行触发以后再运行.但是,如果要在数据库中执行该操作,请创建一个队列表,在其中存储要执行的操作,然后使用SQL Agent定期运行计划的作业,该作业将读取队列表并执行适当的操作.

如果半小时是准确的时间,则可以在实际触发器中创建计划的任务,并将该任务安排为延迟半小时.

无论如何,只要记住排队的操作是并且不应成为事务的一部分.
As said, you cannot make the trigger run any later. But if you want to do the operation in the database, create a queue table where you store what you want to do and use the SQL Agent to run a scheduled job regularly which reads the queue table and executes proper actions.

If the half an hour is an exact time, then you can create the scheduled task inside the actual trigger and schedule the task to half an hour late.

In any case, just remember that the queued operation is and shouldn''t be part of the transaction.


这篇关于我们如何根据时基更新触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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