Quantcast
Channel: Microsoft Dynamics AX
Viewing all articles
Browse latest Browse all 130240

Forum Post: RE: Clearing AIF document Logs in Dynamics AX 2009

$
0
0

Hi

You are right. My post is not complete here. The idea is to commit the delete in batches, because SQL Server will "back-up" the lines it is trying to delete in case the operation is rolled back for some reason. It might be that you would want to wrap the deletion with a begin and commit transaction, though if I remember correctly it worked without when I tried.

If you need to wrap it, try this instead:

SELECT 1

WHILE @@ROWCOUNT > 0

BEGIN

  BEGIN TRANSACTION

  DELETE TOP (50000)

     FROM AIFMESSAGELOG

  COMMIT

END

Just replace the tablename with the table you need to flush out. I'm sorry for not answering that part complete and correctly.

Here are some pretty good posts explaining this further and you might find inspiring:

alexandrebrisebois.wordpress.com/.../deleting-large-amounts-of-records-from-a-table-without-truncating-on-windows-azure-sql-database

merill.net/.../deleting-millions-of-records-from-a-table-without-blowing-the-transaction-log

wikidba.wordpress.com/.../sql-server-delete-millions-of-rows-without-hampering-the-transaction-log


Viewing all articles
Browse latest Browse all 130240