• Luis Cazares (11/6/2013)


    steven.ensslen (11/6/2013)


    If I had to guess, the problem is that a single DELETE is too large to fit in the transaction log. DELETE is the wrong tool for the job. A cursor loop reduces the size of each transaction, so they would not overflow the log, but it is still naive.

    The correct solution here is to partition the table. The SWITCH out the old partition with all of its data.

    http://technet.microsoft.com/en-us/magazine/2007.03.partitioning.aspx

    It depends as the OP is not interested on keeping old data.

    I disagree. If we want to get rid of the data SWITCH the partition then to DROP or TRUNCATE the destination table will be thousands of times faster/less-work-for-the-db than a DELETE. The only reason for the DELETE would be some sort of transaction replication, like log-shipping for Disaster Recovery.