Export (0) Print
Expand All
Expand Minimize

How to: Specify that Deletes Should Not Be Tracked (Replication Transact-SQL Programming)

By default, merge replication synchronizes DELETE commands between the Publisher and Subscriber. Merge replication enables you to retain rows in the subscription database even when they have been deleted from the publication, and vice versa. You can programmatically specify that DELETE commands be ignored when creating a new article or you can enable this functionality at a later time using replication stored procedures.

ms146947.note(en-US,SQL.90).gifImportant:
Enabling this functionality will result in non-convergence, which means that data present at the Subscriber will not accurately reflect data at the Publisher. You must implement your own mechanism for manually removing deleted rows.

  1. At the Publisher on the publication database, execute sp_addmergearticle (Transact-SQL). Specify a value of false for @delete_tracking. For more information, see How to: Define an Article (Replication Transact-SQL Programming).

    ms146947.note(en-US,SQL.90).gifNote:
    If the source table for an article is already published in another publication, the value of delete_tracking must be the same for both articles.

  1. To determine if error compensation is enabled for an article, execute sp_helpmergearticle (Transact-SQL) and note the value of delete_tracking in the result set. If this value is 0, deletes are already being ignored.

  2. If the value from step 1 is 1, execute sp_changemergearticle (Transact-SQL) at the Publisher on the publication database. Specify a value of delete_tracking for @property, and a value of false for @value.

    ms146947.note(en-US,SQL.90).gifNote:
    If the source table for an article is already published in another publication, the value of delete_tracking must be the same for both articles.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft