I am trying to move close 88101840 rows from one table to another. To handle log growth on the server looking at doing 10000 rows at time. Please have a look at the query below. Just want to find if this way is good or would there be a better way to do it.
DECLARE @Archive_Rows INT; SET @Archive_Rows = 1; WHILE (@Archive_Rows > 0) BEGIN DELETE TOP (10000) Audit OUTPUT deleted.* INTO AuditArchive WHERE EVENTYEAR = '2016'; SET @Archive_Rows = @@ROWCOUNT; END