Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

sql server - MSSQL record date/time auto delete

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...