Default value not replicated

  • Hello,

    I'm trying to setup Merge replication via SMO.

    Everything seems to work, except when I take a look in the Table properties at the subscribers side, the "Default Value or Binding" Field of a column doesn't contain a value. At the publisher side, this one does have a value.

    This is a snapshot of the code I use to create the Merge article.

    mergeArticle = new MergeArticle(articleName, publication.Name, mDatabaseName, conn);

    mergeArticle.SourceObjectName = mergeArticle.Name;

    mergeArticle.SourceObjectOwner = "dbo";

    mergeArticle.Type = ArticleOptions.TableBased;

    // Ensure that we create the schema owner at the Subscriber.

    mergeArticle.SchemaOption |= CreationScriptOptions.Schema;

    mergeArticle.SchemaOption |= CreationScriptOptions.DefaultBindings;

    I thought that, with DefaultBindings added to the SchemaOption, it should work, but it doesn't.

    Hope someone can help!

    Thanks in advance,

    Marcel de Vries

  • Hi there,

    After some searching I found the answer for my own problem 🙂

    To replicate the default values for a table, you must add the option CreationScriptOptions.DriDefaults to the SchemaOption of the MergeArticle.

    Regards,

    Marcel de Vries

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply