如何在几天或65天后自动从数据库中删除数据 [英] how to automatically delete data from data base after some days or 65 days

查看:81
本文介绍了如何在几天或65天后自动从数据库中删除数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,解决我的问题.
如何在几天或65天后自动从数据库中删除数据.

hi everyone to solve my problem.
how to automatically delete data from data base after some days or 65 days.

推荐答案

这在一定程度上取决于规格,数据库大小等...
您还想要永久删除数据或将其移动到历史记录表吗?
看看级联".

您可以创建一个计划任务,该任务通过执行一些清理的bat文件来执行SQL文件,或者您可能想编写一个可配置的应用程序.
另一种选择是在应用程序运行时对其内部进行检查,并例如分配一个后台线程以在必要时进行清理. (这确实意味着您的应用程序需要正常运行,并且需要在应用程序中放置一个点并进行检查)

是否要每65天检查一次并删除全部,还是要每天删除65天之前的所有内容?

我建议您考虑一些您想要实现的目标,然后再回到这里来解决更具体的问题.
That depends a little on the specifications, the size of the database etc...
Also do you want to permanently delete the data or move them to a history table?
Have a look at "cascading".

You can create a scheduled task that executes an SQL file via a bat file that does some clean up or alternatively you may want to write a configurable application.
Another option is to do a check inside your application when it is running and assign a background thread for example to clean up in case it is necessary. (that does mean your application needs to be running regularly and you need a good point in your application to place and check this)

Do you want to check each 65 days and delete all or do you want to check each day and delete everything older then 65 days?

I suggest you contemplate a little more on what you want to achieve and come back here with more specific issues.


这篇关于如何在几天或65天后自动从数据库中删除数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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