• You could try using something like this:

    declare @BatchSize int = 10000;

    while @BatchSize <> 0

    begin

    begin try

    begin transaction

    delete top (@BatchSize)

    from dbo.SPTLog

    output

    deleted.LogID, deleted.LogTime, getdate()

    into

    dbo.SPTLogArchive(LogID,LogTime,ArchiveTime)

    where

    LogTime < @dCutOffDate;

    set @BatchSize = @@ROWCOUNT;

    commit transaction;

    end try

    begin catch

    rollback transaction;

    set @BatchSize = 0; -- if you want to abort the delete, or set to 10000 if to continue

    end catch

    end