如何在达到某个天数后删除mssql表中的记录 [英] How do I delete a record in mssql table when some number of days has reached

查看:68
本文介绍了如何在达到某个天数后删除mssql表中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一张包含一些记录的表格。当用户单击删除按钮时,该记录将不会被永久删除,但会被标记。当达到一定天数后,它将被永久删除。如何在不使用mssql中的Agent的情况下实现此目的。谢谢

There is a table with some records. When a user clicks the delete button, the record will not be permanently deleted but will be flagged. When some number of days has reached then it is permanently deleted. How do I achieve this without using Agent in mssql. Thanks

推荐答案

你必须使用在一定时间后触发的东西。如果您不想执行预定作业,则需要使用自己的其他调度程序。例如,您始终可以在删除存储过程中添加代码,以实际删除在x天前删除的所有记录。如果您不想安排工作,这可能是最简单的。
You have to use something that fires after a certain amount of time. If you don't want to do a scheduled job then you need to use a different scheduler of your own. For example, you could always add code in your delete stored procedure to actually delete any records that were deleted over x number of days ago. That might be the easiest if you don't want to schedule a job.


这篇关于如何在达到某个天数后删除mssql表中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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