课程过期时SQL Server触发器触发 [英] SQL Server Trigger Fire When Courses are Expired
本文介绍了课程过期时SQL Server触发器触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我有一个名为EmployeeCoureses的表,我想写一个sql触发器,当课程到期日期少于今天的日期,我想写一个触发器,每天检查课程有效期并发送电子邮件通知。
如何执行此触发器。
桌子结构
Trn_CourseExpiry
Cs_EmpNo数字
Cs_No数字
Cs_CourseExpiry日期
谢谢
Basit。
Dear All,
I have a table called EmployeeCoureses, I want to write a sql trigger on that when Course Expiry Date less then today date, i want to write a trigger which every day is checking course expiry date and send an email notification.
How to do this trigger.
Table Structure
Trn_CourseExpiry
Cs_EmpNo Numeric
Cs_No numeric
Cs_CourseExpiry Date
Thanks
Basit.
推荐答案
Hi
MSSQL中的触发器是一段代码的概念,当您更改表中的数据时执行该代码。无论是插入还是更新/删除,都会因数据操作而发生。所以你看到你不需要触发器。
如果你设置了一个执行TSQL任务的维护计划,你在MSSQL中需要的是一个维护计划,然后获取所有过期的cource,例如没有设置过期日期,并用今天更新那些并发送邮件。
维护计划
Mail来自SQL
您好
在sql调度中使用您的查询
谢谢
Mangesh
Hi
Use your query in sql scheduling
Thanks
Mangesh
您好,
As我知道,对于使用触发器,您需要一些触发事件,如插入/更新/删除。
您的要求似乎与触发器概念不同。您可以创建一个控制台应用程序来检查到期日期并发送邮件。此外,在所需时间安排申请。
希望这对您有所帮助。
干杯
Hi,
As i know, for using Triggers you need some triggering events like insert / update / delete.
Your requirement seems to be different from Trigger concepts. You can create a console application which checks the expiry and send the mail. Also, schedule that application on required time.
Hope this will help you.
Cheers
这篇关于课程过期时SQL Server触发器触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文