Monday, February 20, 2012

Merge Replication and Filtering by date

With SQL Server 2005 adding a merge filter that used a column with a date did not work very well. I have a table that has an expiration date. Ideally, I would want to set a filter that says send to the subscriber if getdate() < expirationdate. The problem in 2005 is that since the data in the row does not change, the row will not be deleted from the subscription when the date passes the expiration date. Microsoft has recommended that another column called something like IsActive should be added and updated every day. This is sometimes not possible. Has this issue been addressed in SQL Server 2008?

Merge replication is trigger-based, you have to explicitly make a change for merge replication to track it, this has always been the design, we use the metadata tables to determine what changes need to be uploaded/downloaded. The recommendation for an "IsExpired" column is a common and easy workaround, you can create a job that runs daily/weekly/hourly to update this column based on the expiration date.

Can you explain in more detail why this workaround is not possible for you? Maybe we can offer another solution/workaround.

|||

I don't really have a particular problem in mind. I was just wondering if SQL 2008 has changed in such a way that the workaround is not needed any longer. If it isn't, then I can just continue to do what I have been, but if it has changed I just wanted to be aware of it. Thanks for your help.

No comments:

Post a Comment