Tag: sql

AUTOMOTIVE

Query to delete data before 90 days in 100-100 batches

Written by:

DECLARE @DELETED_ROWS INT; SET @DELETED_ROWS = 100 WHILE (@DELETED_ROWS > 0) BEGIN WITH cte AS ( SELECT DATEADD(DAY, -90, UPDATEDDATE) AS date, audit_id FROM auditdata ) …