Archive a table- data older than 6 months

  • Hi

     

    Does anyone have any scripts to archive data older than 6 months?

    I  have one column in the table that has the row added date and time.

     

     

    Thanks

     

  • Your handle says "SQLDBA" so I'm thinking that you know where Books Online is...  lookup DATEADD, Insert, Delete, and WHERE NOT IN.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I have already written a stored procedure and placed in my blog http://sugeshkr.blogspot.com which archive data for a datefield every 45 days you can change the sp as per your convience.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • I'd also like to add that in the real world it is seldom as easy as filtering on a date for a single table. You'll need to know whether or not that data is referenced somewhere else in your database and if it is, you'll need to deal with it there also.

Viewing 4 posts - 1 through 3 (of 3 total)

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