Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void CleanAbc()
- {
- using (var sql = Program.Connection())
- {
- sql.Execute(@"
- declare @expiration datetime = DATEADD(DAY, -21, cast(GETDATE() AS DATE));
- with topfew as (select top 100000 * from abc with(paglock)
- WHERE [time] < @expiration)
- delete topfew;
- set @expiration = DATEADD(MONTH, -6, cast(GETDATE() AS DATE));
- with topfew as (select top 100000 * from abc with(paglock)
- WHERE [time] < @expiration)
- delete topfew;
- ", commandTimeout: 60 * 60 * 12);
- }
- }
Add Comment
Please, Sign In to add comment