The basic problem is like this:
A subscriber has successfully replicated a row from the publisher, using transactional replication. Now, how do we keep track the time of this row being last successfully replicated?
A friend has suggested the following solution, which he used for his SQL Server 2000:
1) Add a datetime column.
2) Change the replication stored procedure to update the datetime column (!).
The step #2 sets off all sorts of warning bells within me, so I'm asking if there are better solutions for SQL Server 2005 in this situation, before I even go into detail with his solution.
I had this exact problem a few weeks ago trying to find records that have changed recently.
Create a new column and set the data type to TIMESTAMP. SS2005 automatically updates this type when the row is updated. The only problem is that this 'timestamp' has nothing at all to do with a date or time, it is just a number that reflects the last successful update of that row (any update, not just via replication). If that is all you need, then you should be fine.
If you need the last replication update, things might get a bit tricky, and you need get your hands dirty with triggers and stored procs.
http://www.sqlteam.com/article/timestamps-vs-datetime-data-types
Hope that helps~
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With