How to: Specify the Processing Order of Merge Table Articles (Replication Transact-SQL Programming)

Merge replication enables you to specify the order in which articles are processed by the Merge Agent during the synchronization process. You can assign an order to each article programmatically when creating an article using replication stored procedures. Articles are processed in order from lowest to highest value. If two articles have the same value, they are processed concurrently. For more information, see Specifying the Processing Order of Merge Articles.

To specify the processing order for a new merge article

  • At the Publisher on the publication database, execute sp_addmergearticle (Transact-SQL). Specify an integer value that represents the processing order for the article for @processing_order. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

    Note

    When creating ordered articles, you should leave gaps between the article order values. This makes it easier to set new values in the future. For example, if you have three articles for which you need to specify a fixed processing order, set the value of @processing_order to 10, 20, and 30 rather than 1, 2, and 3, respectively.

To change the processing order of a merge article

  1. To determine processing order of an article, execute sp_helpmergearticle (Transact-SQL) and note the value of processing_order in the result set.

  2. At the Publisher on the publication database, execute sp_changemergearticle (Transact-SQL). Specify a value of processing_order for @property and an integer value that represents the processing order for @value.