自动从数据库中删除数据 [英] auto delete data from database

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

问题描述

我需要每天更新一个SQL数据库,删除过期的条目。因此,我必须在数据库中的字段名为'date'和'expired'(这是实际的日期......我如何得到它再次?)。

I need to update a SQL database every day in terms of deleting expired entries.Therefore, I have to fields in the db named 'date' and 'expired' (which is the actual date ... How do I get that again?).

推荐答案

如果您使用的是SQL Server,那么SQL Server提供了一个定义作业的选项。您可以定义作业并编写您每天执行的查询,但是以通用方式可以自动检查要删除的数据的日期。完成后,将该作业的设置设置为每天运行一次。 Sql Server的作业就像服务一样运行,并且通过设置它在一天中运行一次就可以自动化你的过程:)
If you are using SQL Server, then SQL Server provides an option to define a job. You can define a job and write that query which you execute on daily basis but in a generic way that it can automatically check for the date of the data to be deleted. After you are done, set the settings of that job to be run once a day. Job of Sql Server runs like a service and by setting it run once in a day you are automating your process :)


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

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