MSSQL记录日期/时间自动删除 [英] MSSQL record date/time auto delete

查看:168
本文介绍了MSSQL记录日期/时间自动删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据每个记录的时间戳从数据库表中删除记录。我希望自动删除与日期/时间间隔相比的记录,无需用户干预或管理干预。

I want to delete records from a db table based on a time-stamp for each record. I would like to have it automatically delete records compared to a date/time interval without user intervention or admin intervention.

最好的方法是什么,我可以创建一个在后台执行检查的进程,但这是我想避免的额外工作?有没有可以用作模板的图书馆/网络服务?

What would be the best way to go about this, I could create a process that runs in the background that does checks but that is extra work I want to avoid? Is there any libraries/web services I could use as templates?

推荐答案

SQL Server代理可以为您做到这一点。

SQL Server Agent can do this for you.

只需创建一个定期安排的工作和您要运行的SQL。有一个易于使用的向导界面来创建作业。

Simply create a job with a regular schedule and the SQL you want to run. There is an easy to use wizard interface for job creation.

这篇关于MSSQL记录日期/时间自动删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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