Safe Delete

bisonn Oct 21st, 2019 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. use MO
  3. declare @i bigint = (select max(id) from [_Log_QueryMO] where DateStart<getdate()-7)
  4. set @i = 51700681
  5. set nocount on
  6. set rowcount 100000
  7. set deadlock_priority low
  8. select 1
  9. while @@rowcount>0 begin
  10.     waitfor delay '00:00:00.2'
  11.     delete [_Log_QueryMO] where id<@i
  12. end
  13. go
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand