Deleting thousands of rows in a table

  • How can I quickly delete thousands of rows in a table (SQL2000) according a query and without blowing up the log file? For instance executing the query:

    Delete from transactions

    WHERE transactiondatestamp < DATEADD (m,-4,GETDATE())

    increases my log file to almost 6GB before job was done an normal size was re-obtained. In addition it took a long to time to get the job done.

    With the command truncate table I cannot use query unfortunately but this would be faster.

    Anyone has an idea?

    mipo

  • mipo, Could you do the deletes in several, smaller batches?

    
    
    WHERE DateDiff(mm,transactiondatestamp,GetDate()) = 4
    .
    .
    WHERE DateDiff(mm,transactiondatestamp,GetDate()) = 3

    Or, if it's particularly large, maybe do DateDiff(dd,transactiondatestamp,GetDate()) = 90, then 89.

    Regards,

    SJTerrill

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply