Aracılığıyla paylaş


sp_addmergepublication (Transact-SQL)

Yeni bir birleştirme yayın oluşturur.Bu saklı yordam yayımlanıyor veritabanı üzerinde yayımcı adresindeki yürütülür.

Konu bağlantısı simgesiTransact-sql sözdizimi kuralları

Sözdizimi

sp_addmergepublication [ @publication = ] 'publication' 
    [ , [ @description = ] 'description' 
    [ , [ @retention = ] retention ] 
    [ , [ @sync_mode = ] 'sync_mode' ] 
    [ , [ @allow_push = ] 'allow_push' ] 
    [ , [ @allow_pull = ] 'allow_pull' ] 
    [ , [ @allow_anonymous = ] 'allow_anonymous' ] 
    [ , [ @enabled_for_internet = ] 'enabled_for_internet' ] 
    [ , [ @centralized_conflicts = ] 'centralized_conflicts' ] 
    [ , [ @dynamic_filters = ] 'dynamic_filters' ] 
    [ , [ @snapshot_in_defaultfolder = ] 'snapshot_in_default_folder' ] 
    [ , [ @alt_snapshot_folder = ] 'alternate_snapshot_folder' ] 
    [ , [ @pre_snapshot_script = ] 'pre_snapshot_script' ] 
    [ , [ @post_snapshot_script = ] 'post_snapshot_script' ] 
    [ , [ @compress_snapshot = ] 'compress_snapshot' ] 
    [ , [ @ftp_address = ] 'ftp_address' ] 
    [ , [ @ftp_port = ] ftp_port ] 
    [ , [ @ftp_subdirectory = ] 'ftp_subdirectory' ] 
    [ , [ @ftp_login = ] 'ftp_login' ] 
    [ , [ @ftp_password = ] 'ftp_password' ] 
    [ , [ @conflict_retention = ] conflict_retention ] 
    [ , [ @keep_partition_changes = ] 'keep_partition_changes' ] 
    [ , [ @allow_subscription_copy = ] 'allow_subscription_copy' ] 
    [ , [ @allow_synctoalternate = ] 'allow_synctoalternate' ] 
    [ , [ @validate_subscriber_info = ] 'validate_subscriber_info' ] 
    [ , [ @add_to_active_directory = ] 'add_to_active_directory' ] 
    [ , [ @max_concurrent_merge = ] maximum_concurrent_merge ] 
    [ , [ @max_concurrent_dynamic_snapshots = ] max_concurrent_dynamic_snapshots ]
    [ , [ @use_partition_groups = ] 'use_partition_groups' ]
    [ , [ @publication_compatibility_level = ] 'backward_comp_level' ]
    [ , [ @replicate_ddl = ] replicate_ddl ]
    [ , [ @allow_subscriber_initiated_snapshot = ] 'allow_subscriber_initiated_snapshot' ] 
    [ , [ @allow_web_synchronization = ] 'allow_web_synchronization' ] 
    [ , [ @web_synchronization_url = ] 'web_synchronization_url' ]
    [ , [ @allow_partition_realignment = ] 'allow_partition_realignment' ]
    [ , [ @retention_period_unit = ] 'retention_period_unit' ]
    [ , [ @generation_leveling_threshold = ] generation_leveling_threshold ]
    [ , [ @automatic_reinitialization_policy = ] automatic_reinitialization_policy ]
    [ , [ @conflict_logging = ] 'conflict_logging' ]

Bağımsız değişkenler

  • [ @publication = ] 'publication'
    Is the name of the merge publication to create.publication is sysname, with no default, and must not be the keyword ALL.Yayın adı veritabanı içinde benzersiz olmalıdır.

  • [ @description = ] 'description'
    Is the publication description.description is nvarchar(255), with a default of NULL.

  • [ @retention = ] retention
    Is the retention period, in retention period units, for which to save changes for the given publication.retention is int, with a default of 14 units.Saklama dönemi birimleri tarafından tanımlanan retention_period_unit.Saklama dönemi içinde abonelik eşitlenir ve almış bekleyen değişiklikleri dağıtımcı adresindeki temizleme işlemi tarafından kaldırılmış, abonelik süresi ve yeniden gerekir.İzin verilen en fazla saklama dönemi arasındaki ara gün sayısıdır.31, 9999 ve geçerli tarih.

    Not

    Saklama dönemi birleştirme yayımları için farklı saat dilimlerinde aboneleri uyması için 24 saatlik yetkisiz kullanım süresi vardır.Eğer, örneğin, küme bir gün, gerçek saklama dönemi, bir saklama dönemi 48 saattir.

  • [ @sync_mode = ] 'sync_mode'
    Is the mode of the initial synchronization of subscribers to the publication.sync_mode is nvarchar(10), and can be one of the following values.

    Değer

    Açıklama

    Yerel (varsayılan)

    Yerel mod toplu kopyalama program çıktı tüm tabloları oluşturur.

    karakter

    Karakter modu toplu kopyalama program çıktı tüm tabloları oluşturur.Required to support Microsoft SQL Server Compact 3.5 SP1 and non-SQL Server Subscribers.

  • [ @allow_push = ] 'allow_push'
    Specifies if push subscriptions can be created for the given publication.allow_push is nvarchar(5), with a default of TRUE, which allows push subscriptions on the publication.

  • [ @allow_pull = ] 'allow_pull'
    Specifies if pull subscriptions can be created for the given publication.allow_pull is nvarchar(5), with a default of TRUE, which allows pull subscriptions on the publication.Destek için true belirtmeniz gerekir SQL Server Compact 3.5 SP1 aboneleri.

  • [ @allow_anonymous = ] 'allow_anonymous'
    Specifies if anonymous subscriptions can be created for the given publication.allow_anonymous is nvarchar(5), with a default of TRUE, which allows anonymous subscriptions on the publication.Desteklemek için SQL Server Compact 3.5 SP1 aboneleri, belirtmeniz gerekir true.

  • [ @enabled_for_internet = ] 'enabled_for_internet'
    Specifies if the publication is enabled for the Internet, and determines if file transfer protocol (FTP) can be used to transfer the snapshot files to a subscriber.enabled_for_internet is nvarchar(5), with a default of FALSE.If true, the synchronization files for the publication are put into the C:\Program Files\Microsoft SQL Server\MSSQL\MSSQL.x\Repldata\Ftp directory.Kullanıcı Ftp dizini oluşturmanız gerekir.If false, the publication is not enabled for Internet access.

  • [ @centralized_conflicts =] 'centralized_conflicts'
    Bu parametre onaylanmaz ve yalnızca komut dosyaları geriye dönük uyumluluk için desteklenir.Use conflict_logging çakışma kayıtları depolandığı konumu belirtmek için.

  • [ @dynamic_filters =] 'dynamic_filters'
    Enables the merge publication to use parameterized row filters.dynamic_filters is nvarchar(5), with a default of FALSE.

    Not

    Bu parametreyi belirtmek ancak bunun yerine izin SQL Server otomatik olarak parametreli satır filtreleri kullanılan belirlemek için.Bir değer belirtirseniz, true için dynamic_filtersiçin parametreli satır filtresi tanımlamak gerekirmakale. Daha fazla bilgi için bkz: Nasıl yapılır: Tanımla ve birleştirme makalesi (çoğaltma Transact-sql programlama) parametreli satır filtre Değiştir.

  • [ @snapshot_in_defaultfolder = ] 'snapshot_in_default_folder'
    Specifies if the snapshot files are stored in the default folder.snapshot_in_default_folder is nvarchar(5), with a default of TRUE.If true, snapshot files can be found in the default folder.If false, snapshot files will be stored in the alternate location specified by alternate_snapshot_folder.Başka bir sunucu, bir ağ sürücüsüne veya çıkarılabilir bir medyaya (CD-ROM'u veya Çıkarılabilir diskler gibi) farklı yerler olabilir.Bir sonraki adresindeki abone tarafından ulaşım için bir Dosya Aktarım Protokolü (ftp) sitesi için anlık görüntü dosyaları kaydedebilirsiniz saat.Not Bu parametre true ve hala tarafından belirtilen bir konuma sahip alt_snapshot_folder.Bu bileşim, anlık görüntü dosyaları hem varsayılan hem de diğer konumlarda depolanan olduğunu belirtir.

  • [ @alt_snapshot_folder = ] 'alternate_snapshot_folder'
    Specifies the location of the alternate folder for the snapshot.alternate_snapshot_folder is nvarchar(255), with a default of NULL.

  • [ @pre_snapshot_script = ] 'pre_snapshot_script'
    Specifies a pointer to an .sql file location.pre_snapshot_script is nvarchar(255), with a default of NULL.Birleştirme Aracısı abone adresindeki anlık görüntü uygularken çoğaltılan nesne komut dosyaları önce pre-anlık görüntü görüntü komut dosyası çalıştırılır.Bağlanırken Birleştirme Aracısı tarafından kullanılan güvenlik bağlamında komut dosyası yürütülür abonelik veritabanı.Pre-anlık görüntü görüntü komut dosyaları değil çalışan SQL Server Compact 3.5 SP1 aboneleri.

  • [ @post_snapshot_script = ] 'post_snapshot_script'
    Specifies a pointer to an .sql file location.post_snapshot_script is nvarchar(255), with a default of NULL.Bir ilk eşitleme sırasında diğer tüm çoğaltılan nesne komut dosyaları ve verileri uygulandıktan sonra Birleştirme Aracısı post-anlık görüntü görüntü komut dosyası çalıştırılır.Bağlanırken Birleştirme Aracısı tarafından kullanılan güvenlik bağlamında komut dosyası yürütülür abonelik veritabanı.POST-anlık görüntü görüntü komut dosyaları değil çalışan SQL Server Compact 3.5 SP1 aboneleri.

  • [ @compress_snapshot = ] 'compress_snapshot'
    Specifies that the snapshot written to the @alt_snapshot_folder location is to be compressed into the Microsoft CAB format.compress_snapshot is nvarchar(5), with a default of FALSE.false specifies that the snapshot will not be compressed; true specifies that the snapshot is to be compressed.2 GB'den büyük olan anlık görüntü dosyaları sıkıştırılamaz.Sıkıştırılmış anlık görüntü dosyaları nerede Birleştirme Aracısı çalıştırır konumda sıkıştırılmamış durumdadır; dosyalar sıkıştırılmamış Abone tarafında olan çekme abonelikleri ile sıkıştırılmış anlık kullanılır.Anlık görüntü varsayılan klasör içinde sıkıştırılamaz.Desteklemek için SQL Server Compact 3.5 SP1 aboneleri, belirtmeniz gerekir false.

  • [ @ftp_address = ] 'ftp_address'
    Is the network address of the FTP service for the Distributor.ftp_address is sysname, with a default of NULL.Birleştirme Aracısı için yayın anlık görüntü dosyaları yerleştirildiği belirtir bir abone çekmek için.Bu özellik her yayın için depolanan bu yana her yayında farklı bir sahip olabilir ftp_address.yayın ftp kullanarak yayılıyor anlık görüntüler desteklemesi gerekir.

  • [ @ftp_port= ] ftp_port
    Is the port number of the FTP service for the Distributor.ftp_port is int, with a default of 21.Birleştirme Aracısı için yayın anlık görüntü dosyaları yerleştirildiği belirtir bir abone çekmek için.Bu özellik her yayın için depolanan bu yana, her birinin kendi olabilir ftp_port.

  • [ @ftp_subdirectory = ] 'ftp_subdirectory'
    Specifies where the snapshot files will be available for the Merge Agent of the subscriber to pick up if the publication supports propagating snapshots using FTP.ftp_subdirectory is nvarchar(255), with a default of NULL.Bu özellik her yayın için depolanan bu yana, her birinin kendi olabilir ftp_subdirctory veya sahip hiçbir alt, belirtilen bir null değeri.

    Parametreli filtreleriyle yayınlar için anlık görüntü görüntüleri pre-generating zaman, veri anlık görüntü her abone bölüm için kendi klasöründe olması gerekir.ftp kullanarak önceden oluşturulmuş anlık görüntüler için dizin yapısı aşağıdaki yapıya uyarlar gerekir:

    alternate_snapshot_folder\ftp\publisher_publicationDB_publication\partitionID.

    Not

    Yukarıdaki değerler italik yayın ve abone bölüm özellikleri bağlı olacaktır.

  • [ @ftp_login = ] 'ftp_login'
    Is the username used to connect to the FTP service.ftp_login is sysname, with a default of 'anonymous'.

  • [ @ftp_password = ] 'ftp_password'
    Is the user password used to connect to the FTP service.ftp_password is sysname, with a default of NULL.

    Güvenlik notuGüvenlik Notu

    Boş parola kullanmayın.Güçlü bir parola kullanın.

  • [ @conflict_retention = ] conflict_retention
    Specifies the retention period, in days, for which conflicts are retained.conflict_retention is int, with a default of 14 days before the conflict row is purged from the conflict table.

  • [ @keep_partition_changes = ] 'keep_partition_changes'
    Specifies whether to enable partition change optimizations when precomputed partitions cannot be used.keep_partition_changes is nvarchar(5), with a default of TRUE.false means that partition changes are not optimized, and when precomputed partitions are not used, the partitions sent to all Subscribers will be verified when data changes in a partition.true means that partition changes are optimized, and only Subscribers having rows in the changed partitions are affected.Precomputed bölümleri kullanırken, küme use_partition_groups için true ve keep_partition_changes için false.Daha fazla bilgi için bkz: Parametreli Filtresi performans Precomputed bölümleri ile en iyi duruma getirme.

    Not

    Bir değer belirtirseniz, true için keep_partition_changes, değeri belirtmek 1 Anlık Görüntü Aracısı parametresi için - maxnetworkoptimization.Bu parametre hakkında daha fazla bilgi için bkz: Çoğaltma Anlık Görüntü Aracısı.Aracısı parametrelerini belirtme hakkında daha fazla bilgi için bkz: Çoğaltma aracıları yönetme.

  • [ @allow_subscription_copy= ] 'allow_subscription_copy'
    Enables or disables the ability to copy the subscription databases that subscribe to this publication.allow_subscription_copy is nvarchar(5), with a default of FALSE.Boyutunu abonelik veritabanı kopyalanan 2 gigabayttan (gb) olmalıdır.

  • [ @allow_synctoalternate = ] 'allow_synctoalternate'
    Yalnızca bilgi amaçlı olarak belirtilmiştir. Desteklenmez. Gelecekteki uyumluluk garanti edilmez.

  • [ @validate_subscriber_info = ] 'validate_subscriber_info'
    Lists the functions that are used to define a Subscriber partition of the published data when parameterized row filters are used.validate_subscriber_info is nvarchar(500), with a default of NULL.Bu bilgiler, abonenin bölüm doğrulamak için Birleştirme Aracısı tarafından kullanılır.Örneğin, suser_sname kullanılan parametreli satır filtresi parametresi olmalıdır @validate_subscriber_info=N'SUSER_SNAME()'.

    Not

    Bu parametreyi belirtmek ancak bunun yerine izin SQL Server otomatik olarak belirleme filtreleme ölçütü.

  • [ @add_to_active_directory = ] 'add_to_active_directory'
    Bu parametre onaylanmaz ve yalnızca komut dosyaları geriye dönük uyumluluk için desteklenir.Artık yayın bilgileri ekleme Microsoft Active Directory.

  • [ @max_concurrent_merge = ] maximum_concurrent_merge
    The maximum number of concurrent merge processes.maximum_concurrent_merge is int with a default of 0.Değeri, 0 için bu özellik eşzamanlı birleştirme işlemleri sırasında verilen çalıştıran sayısı için bir sınır yoktur anlamına gelir saat.Bu özellik bir birleştirme yayını bir karşı çalıştırmak eşzamanlı birleştirme işlemleri sayısı sınırlar saat.Daha fazla birleştirme işlemleri aynı anda zamanlanmış olup olmadığını saat çalıştırmak için değeri verir sonra aşırı işlerini kuyruğa ve bekleme işlemi şu anda-çalışan bir birleştirme kadar biter.

  • [ @max_concurrent_dynamic_snapshots =] max_concurrent_dynamic_snapshots
    The maximum number of Snapshot Agent sessions that can be run concurrently to generate filtered data snapshots for Subscriber partitions.maximum_concurrent_dynamic_snapshots is int with a default of 0.If 0, there is no limit to the number snapshot sessions.Daha fazla anlık işlemler aynı anda zamanlanmış olup olmadığını saat çok çalıştırmak için değer verir sonra aşırı işlerini kuyruğa ve şu anda-çalışan bir işlemi anlık görüntüsünü kadar bekleyin tamamlanır.

  • [ @use_partition_groups = ] 'use_partition_groups'
    Specifies that precomputed partitions should be used to optimize the synchronization process.use_partition_groups is nvarchar(5), and can be one of these values:

    Değer

    Açıklama

    true

    Yayını precomputed bölümleri kullanır.

    false

    Yayını precomputed bölümleri kullanın.

    Null(default)

    Sistem bölümleme stratejisi olarak karar verir.

    Precomputed bölümleri varsayılan olarak kullanılır.Precomputed bölümler kullanma önlemek için use_partition_groups olması küme için false.null olduğunda, sistem precomputed bölümleri kullanılıp kullanılamayacağını karar verir.Önceden hesaplanan bölümleri kullanılamaz ve bu değer etkili olacak, false olmadan üretme tüm hataları.Bu gibi durumlarda keep_partition_changes olabilir küme için true sağlamaya yönelik bazı en iyi duruma getirme.Daha fazla bilgi için bkz: Parametreli satır filtreleri ve Parametreli Filtresi performans Precomputed bölümleri ile en iyi duruma getirme.

  • [ @publication_compatibility_level = ] backward_comp_level
    Indicates the backward compatibility of the publication.backward_comp_level is nvarchar(6), and can be one of these values:

    Değer

    Sürüm

    70RTM

    SQL Server 7.0

    70SP1

    SQL Server 7.0 Service Pack 1

    70SP2

    SQL Server 7.0 Service Pack 2

    70SP3

    SQL Server 7.0 Service Pack 3

    70SP4

    SQL Server 7.0 Service Pack 4

    80RTM

    SQL Server 2000

    80SP1

    SQL Server 2000 Service Pack 1

    80SP2

    SQL Server 2000 Service Pack 2

    80SP3

    SQL Server 2000 Service Pack 3

    90RTM

    SQL Server 2005

    100RTM

    SQL Server 2008

  • [ @replicate_ddl = ] replicate_ddl
    Indicates if schema replication is supported for the publication.replicate_ddl is int, with a default of 1.1 belirten veri tanımlama dili (ddl) deyimleri Yayımcı tarafında yürütülen yinelenir ve 0 ddl deyimleri değil çoğaltılır gösterir.Daha fazla bilgi için bkz: Yayını veritabanları üzerinde şeması değişiklikler yapma.

  • [ @allow_subscriber_initiated_snapshot = ] 'allow_subscriber_initiated_snapshot'
    Indicates if Subscribers to this publication can initiate the snapshot process to generate the filtered snapshot for their data partition.allow_subscriber_initiated_snapshot is nvarchar(5), with a default of FALSE.true indicates that Subscribers can initiate the snapshot process.

  • [ @allow_web_synchronization = ] 'allow_web_synchronization'
    Specifies if the publication is enabled for Web synchronization.allow_web_synchronization is nvarchar(5), with a default of FALSE.true specifies that subscriptions to this publication can be synchronized over HTTPS.Daha fazla bilgi için bkz: Birleştirme çoğaltması Web eşitleme.Desteklemek için SQL Server Compact 3.5 SP1 aboneleri, belirtmeniz gerekir true.

  • [ @web_synchronization_url= ] 'web_synchronization_url'
    Specifies the default value of the Internet URL used for Web synchronization.web_synchronization_url is nvarchar(500), with a default of NULL.Biri açıkça değilse, varsayılan Internet URL'si tanımlar küme , sp_addmergepullsubscription_agent yürütülür.

  • [ @allow_partition_realignment = ] 'allow_partition_realignment'
    Determines whether deletes are sent to the subscriber when modification of the row on the publisher causes it to change its partition.allow_partition_realignment is nvarchar(5), with a default of TRUE.true sends deletes to the Subscriber to reflect the results of a partition change by removing data that is no longer part of the Subscriber's partition.false leaves the data from an old partition on the Subscriber, where changes made to this data on the Publisher will not replicate to this Subscriber, but changes made on the Subscriber will replicate to the Publisher.Ayar allow_partition_realignment için false , tarihsel amaçlar için erişilebilir olması için gereksinim duyduğu verileri eski bir bölümünden bir abonelik verileri korumak için kullanılır

    Not

    Ayar, abone kalır veri allow_partition_realignment için false kabul gibi salt okunur; Ancak, bu çoğaltma sistemi tarafından zorlanmaz.

  • [ @retention_period_unit = ] 'retention_period_unit'
    Specifies the units for the retention period set by retention.retention_period_unit is nvarchar(10), and can be one of the following values.

    Değer

    Sürüm

    gün (varsayılan)

    Saklama dönemi gün içinde belirtilir.

    hafta

    Saklama dönemi hafta olarak belirtilir.

    ay

    Saklama dönemi, ay cinsinden belirtilir.

    yıl

    Saklama dönemi, yıl içinde belirtilir.

  • [ @generation_leveling_threshold= ] generation_leveling_threshold
    Bir kuşak içinde bulunan değişiklik sayısını belirtir.A generation is a collection of changes that are delivered to a Publisher or Subscriber.generation_leveling_threshold is int, with a default value of 1000.Daha fazla bilgi için bkz: Birleştirme çoğaltması nasıl izler ve değişiklikleri numaralandırır.

  • [ @automatic_reinitialization_policy = ] automatic_reinitialization_policy
    Specifies whether changes are uploaded from the Subscriber before an automatic reinitialization required by a change to the publication, where a value of 1 was specified for @force_reinit_subscription.automatic_reinitialization_policy is bit, with a default value of 0.1 bir otomatik reinitialization oluşmadan önce değişiklikleri abonenin karşıya anlamına gelir.

    Önemli notÖnemli

    Ekleme, bırakma veya parametreli filtre değiştirme, bekleyen değişiklikleri abone adresindeki yayımcı için yeniden başlatılması sırasında karşıya yüklenemiyor.Bekleyen değişiklikleri karşıya yüklemek istiyorsanız, filtre değiştirmeden önce tüm abonelikleri eşitleyin.

  • [ @conflict_logging = ] 'conflict_logging'
    Specifies where conflict records are stored.conflict_logging is nvarchar(15), and can be one of the following values:

    Değer

    Açıklama

    Yayımcı

    Çakışma kayıtları Yayımcı tarafında saklanır.

    Abone

    Çakışmaya neden Abone tarafında çakışma kayıtları depolanır.Desteklenen değil SQL Server Compact 3.5 SP1 aboneleri.

    Both (Her ikisi)

    Çakışma kayıtları saklanır hem de Yayımcı ve abone.

    Null(default)

    Çoğaltma otomatik olarak ayarlar conflict_logging için hem zaman değeri backward_comp_level olan 90RTM ve publisher tüm diğer durumlarda.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (hata)

Açıklamalar

sp_addmergepublication birleştirmede kullanılan çoğaltma.

Active Directory kullanarak yayın nesneleri listesi için @ add_to_active_directory parametresi SQL Server Nesne zaten oluşturulmalı Active Directory.

Kendi, birden çok yayınları varsa aynı veritabanı nesnesi, yalnızca yayınları ile yayınlama bir replicate_ddl değeri 1 alter table, alter VIEW, alter procedure, alter işlevi ve alter tetikleyici ddl deyimleri çoğaltılır.Ancak, bir tablo drop sütun ddl alter deyim bırakılan sütun yayımlamakta olduğunuz tüm yayınları tarafından çoğaltılır.

İçin SQL Server Compact 3.5 SP1 aboneleri, değeri alternate_snapshot_folder yalnızca kullanıldığında değeri snapshot_in_default_folder olan false.

With DDL replication enabled (replicate_ddl**=1**) for a publication, in order to make non-replicating DDL changes to the publication, sp_changemergepublication (Transact-SQL) must first be executed to set replicate_ddl to 0.Çoğaltılıyor ddl deyimleri verildikten sonra sp_changemergepublication ddl çoğaltma yeniden açmak için tekrar çalıştırılabilir.

Örnek

-- To avoid storing the login and password in the script file, the value 
-- is passed into SQLCMD as a scripting variable. For information about 
-- how to use scripting variables on the command line and in SQL Server
-- Management Studio, see the "Executing Replication Scripts" section in
-- the topic "Programming Replication Using System Stored Procedures".

--Declarations for adding a merge publication
DECLARE @publicationDB AS sysname;
DECLARE @publication AS sysname;
DECLARE @login AS sysname;
DECLARE @password AS sysname;
SET @publicationDB = N'AdventureWorks2008R2'; 
SET @publication = N'AdvWorksSalesOrdersMerge'; 
SET @login = $(Login);
SET @password = $(Password);

-- Enable merge replication on the publication database, using defaults.
USE master
EXEC sp_replicationdboption 
  @dbname=@publicationDB, 
  @optname=N'merge publish',
  @value = N'true' 

-- Create a new merge publication, explicitly setting the defaults. 
USE [AdventureWorks2008R2]
EXEC sp_addmergepublication 
-- These parameters are optional.
  @publication = @publication,
  -- optional parameters 
  @description = N'Merge publication of AdventureWorks2008R2.',
  @publication_compatibility_level  = N'90RTM';

-- Create a new snapshot job for the publication.
EXEC sp_addpublication_snapshot 
  @publication = @publication, 
  @job_login = @login, 
  @job_password = @password;
GO

İzinler

Yalnızca üyeleri sysadmin sabit sunucu rolü veya db_owner sabit veritabanı rolü olabilir yürütmek sp_addmergepublication.