[英]Check SQL Server table every month
I need to check entries in a database every month to see if they have been updated. 我需要每月检查一次数据库中的条目,以查看它们是否已更新。 For example, an entry would look something like this: 例如,一个条目看起来像这样:
id timestamp completed
123 12-AUG-2011 N
I need to check to see if the entries in this table have been 'completed' within 30 days of their timestamp. 我需要检查该表中的条目在其时间戳记的30天内是否已“完成”。 I then need to send an e-mail to specified person who can then handle the ageing entry. 然后,我需要向指定的人发送电子邮件,然后他们可以处理老化的条目。
Is there a way to achieve this using just C# (Visual Studio 2010) and SQL Server 2008? 有没有办法仅使用C#(Visual Studio 2010)和SQL Server 2008来实现这一目标? Scripts are disallowed on this particular server I am working with so I'm hoping there is an alternate solution. 我正在使用的这台特定服务器上不允许使用脚本,因此希望有替代的解决方案。
Thanks. 谢谢。
You could create a very simple Windows Service to run at whichever time interval you require. 您可以创建一个非常简单的Windows服务,以在所需的任何时间间隔运行。 So say every month it would tick and dispatch an event to perform the checking and email if needed and when finished set the interval again to the next month. 因此,说每个月都会打勾并调度一个事件,以便在需要时执行检查和发送电子邮件,完成后再将间隔设置为下个月。 This way you could expand easily enough at a later point. 这样,您以后可以轻松扩展。
If you've not done a service before then this article might be a nice start. 如果您之前没有做过服务,那么本文可能是一个不错的开始。
Hope that helps. 希望能有所帮助。
Paul 保罗
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.