MSSQL record date/time auto delete

后端 未结 2 779
执念已碎
执念已碎 2020-12-03 11:45

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

2条回答
  •  清歌不尽
    2020-12-03 12:03

    Create a sql JOB with below query:

    UPDATE [dbo].[User] WITH (ROWLOCK) SET active_flag=0 where lastlogindt < DATEADD(Day,-90,GETDATE())

提交回复
热议问题