I have a central suscriber with 5 publishers. After replication, I want to get the last synchronization date and the 开发者_StackOverflow社区server that made that synchronization. Is it possible to find this information from existing tables that SQL Server uses for replication?
I use something simmiler to this to check last replication times. However this is on a database level and not a table level. this is ran from the distribution database of the publisher.
SELECT MAX(DISTINCT h.[time]) AS RunTime
FROM MSmerge_history h INNER JOIN
MSmerge_agents a ON a.id = h.agent_id
WHERE (a.publisher_db = 'PublishedDbName')
AND (h.runstatus <> 1)
AND Left(h.comments,2) = 'Up'
OR (a.publisher_db = 'PublishedDbName')
AND (h.runstatus <> 1)
AND Left(h.comments,2) = 'No'
OR (a.publisher_db = 'PublishedDbName')
AND (h.runstatus <> 1)
AND Left(h.comments,2) = 'Me'
And Publication Like 'PublictionName%'
GO
精彩评论