MSSQL record date/time auto delete

放肆的年华 提交于 2019-11-26 16:46:09

问题


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?


回答1:


SQL Server Agent can do this for you.

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.



来源:https://stackoverflow.com/questions/582506/mssql-record-date-time-auto-delete

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!