• funooni (8/8/2014)


    Lynn Pettis (8/8/2014)


    funooni (8/8/2014)


    Lynn Pettis (8/8/2014)


    There are other issues with your query, but lets not worry about that just yet. Another question, what edition of SQL Server are you running?

    Also, is the intent to keep 3 months of data in the table going forward?

    If so, is that 3 months plus the current month?

    Yes its the current month and last three months i.e. May, June, July and August.

    I am using SQL Server 2008 R2

    Edition, not version. Are you running Standard Edition or Enterprise Edition.

    Since you are using Enterprise Edition I would look at using partitioning to facility data management. This will require establishing a clustered index on the table, and looking at the code you posted I would say on the AuditDateTime column. By using partitioning you will be able to use a sliding window to easily delete (actually switch out) a one month partition of data and start a new one. This will make managing the data much easier.

    I would recommend that you start by reading about partitioning in Books Online and set up a sandbox database where you can practice setting up the table and management of the partitions.

    Oh its Enterprise Edition.

    By the way the previous roll back is still going on and I am expecting it to take another two hours as per my calculation of remaining rows.

    Right now I am ran out of Tempdb Log file space 🙁