如何在一段时间后自动删除sql server中的记录 [英] How to automatically delete records in sql server after a certain amount of time
问题描述
我在我的sql数据库上设置了临时用户帐户,其中存储了我的网站用户添加的用户名,密码和日期。
I have set up temporary user accounts on my sql database where the user names, passwords and date added of my websites users are stored.
有这些记录删除程序,但现在我想知道如果sql server 2008有一个内置的函数,允许记录自动删除后,让说一天。
I was initially going to have these records delete programmatically but now im wondering if sql server 2008 has a built in function that allows records to be auto-deleted after lets say one day.
这将解决用户在临时帐户关闭后能够保持登录状态的问题
This would resolve the issue of a user being able to stay logged into the system after their temporary account is closed
感谢
推荐答案
您可以创建一个 SQL作业
天并执行指定的存储过程。
You could create a SQL Job
to run each day and execute a specified stored procedure.
http:// technet.microsoft.com/en-us/library/ms190268.aspx
这篇关于如何在一段时间后自动删除sql server中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!