1

When configuring a new Merge Replication, setting properties of all articles, I'm having a problem. In Destination Object -> Action if name is in use, I can select four different options. I'm trying to figure out what is each one. I'm not finding anything about it, they are:

  • Keep existing object unchanged
  • Drop existing object and create a new one
  • Delete data. If article has a row filter, delete only data that matches the filter.
  • Truncate all data in the existing object
Alexandre_Almeida
  • 131
  • 1
  • 3
  • 10

1 Answers1

2

The article property Action if name is in use correlates to the @pre_creation_cmd argument of sp_addmergearticle:

Specifies what the system is to do if the table exists at the subscriber when applying the snapshot. pre_creation_cmd is nvarchar(10), and can be one of the following values.

none - If the table already exists at the Subscriber, no action is taken.

delete - Issues a delete based on the WHERE clause in the subset filter.

drop (default) - Drops the table before re-creating it. Required to support Microsoft SQL Server Compact Subscribers.

truncate - Truncates the destination table.

Brandon Williams
  • 3,695
  • 16
  • 19
  • I'm having this problem "Source: Microsoft SQL Server Native Client 11.0 Number: 3726 Message: Could not drop object 'dbo.eqp_Equipment' because it is referenced by a FOREIGN KEY constraint."... If I select "truncate" will solve the problem? I will do it now, I'll post my result . – Alexandre_Almeida May 11 '15 at 20:29
  • I couldn't change with sp_changemergearticle... It returns a error "Property 'pre_creation_command' of article 'myArticle' cannot be changed.". I'm recreating the Merge Replication... I'll post if it works or not :) – Alexandre_Almeida May 11 '15 at 21:14
  • It didn't work... I still get the same error =(... actually it changed a little " Cannot truncate table 'dbo.eqp_Equipment' because it is being referenced by a FOREIGN KEY constraint. (Source: MSSQLServer, Error number: 4712)" – Alexandre_Almeida May 11 '15 at 22:43
  • What I find confusing and poorly documented (or perhaps I'm just stupid) is what exactly "none" refers to. Is this referring to schema related processes only? Or both schema and data processes? – pim Oct 17 '17 at 10:43