Sunday, September 23, 2007

MSmerge_Contents, MSmerge_genhistory, MSmerge_tombstone

Pay attention to the GENERATION column
INSERT SalesOrderDetail (SalesOrderID,OrderQty,ProductID,SalesOrderDetailID)
VALUES( 43660,2,775,15)
INSERT SalesOrderDetail (SalesOrderID,OrderQty,ProductID,SalesOrderDetailID)
VALUES( 43660,7,770,51)
INSERT SalesOrderDetail (SalesOrderID,OrderQty,ProductID,SalesOrderDetailID)
VALUES( 43660,7,770,14)

DELETE FROM SalesOrderDetail
WHERE SalesOrderDetailID=15
DELETE FROM SalesOrderDetail
WHERE SalesOrderDetailID=51
Run Merge Agent:

Only one insert --net result replicated.
A generation is a collection of changes that is delivered to a Publisher or Subscriber. Generations are closed each time the Merge Agent runs; subsequent changes in a database are added to one or more open generations.

The merge metadata tables, such as MSmerge_genhistory, MSmerge_tombstone, and MSmerge_contents, are located in the same database as the articles you are publishing; whereas the metadata tables of transactional publication are located in distribution database. When backing up a database, the merge metadata is automatically backed up. This is not the case for transactional replication databases.