Trans Replication - deleting old records

  • Here's what I'm trying to do (Maybe there's a better way)

    I'm using Transaction Replication and a pull subscription to get all the transactions from the ORDERS table within the last year from Server_A to Server_B. I filter the rows "WHERE (ORDR_DATE > (GETDATE()) - 365)"

    That works fine, BUT, the old rows in the subscriber's ORDERS table do not get deleted, so I have all the records for the last year, plus the older records that I don't want any more. Do I need another step some where that does a "Delete WHERE (ORDR_DATE < (GETDATE()) - 365)" But then I have to maintain my date logic in more than 1 place if I ever want to change it.

    Any suggestions, thoughts, improvements will be appreciated .... Thanks a lot

    Edited by - homebrew01 on 07/14/2003 09:09:31 AM

  • Typically you do set up a job to do stuff like that. Alternatively you could just send over a new snapshot once a week/month which would clean out old data to that point.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • If you are using stored procedures to replicate the changes, you can alter those prodecures, to delete the data you want when the distrib agent runs.

  • Downside to that is you're continuously checking (if you can call that a downside) and that it only happens when you push a change, so if you had a period with no changes, the old rows would accrue. Not a big deal probably.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

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

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