Aracılığıyla paylaş


sp_addmergepullsubscription (Transact-SQL)

istek temelli abonelik için birleştirme ekler yayın.Bu saklı yordam, abonelik veritabanı abone adresindeki yürütülür.

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

Sözdizimi

sp_addmergepullsubscription [ @publication= ] 'publication' 
    [ , [ @publisher= ] 'publisher' ] 
    [ , [ @publisher_db = ] 'publisher_db' ] 
    [ , [ @subscriber_type= ] 'subscriber_type' ] 
    [ , [ @subscription_priority= ] subscription_priority ] 
    [ , [ @sync_type= ] 'sync_type' ] 
    [ , [ @description= ] 'description' ]

Bağımsız değişkenler

  • [ @publication=] 'publication'
    Is the name of the publication.publication is sysname, with no default.

  • [ @publisher=] 'publisher'
    Is the name of the Publisher.Publisher is sysname, with a default of the local server name.Yayımcı, geçerli bir sunucu olması gerekir.

  • [ @publisher_db =] 'publisher_db'
    Is the name of the Publisher database.publisher_db is sysname, with a default of NULL.

  • [ @subscriber_type=] 'subscriber_type'
    Is the type of Subscriber.subscriber_type is nvarchar(15), and can be global, local or anonymous.De SQL Server 2005 ve sonraki sürümleri, yerel abonelikleri bilinir olarak istemci abonelikleri ve genel abonelikleri bilinir olarak sunucu abonelikleri.Daha fazla bilgi için bkz: "Abonelik türleri" Bölüm'de Birleştirme çoğaltması nasıl algıladığı ve çakışmaları giderir.

  • [ @subscription_priority=] subscription_priority
    Is the subscription priority.subscription_priorityis real, with a default of NULL.Yerel ve anonim abonelikleri için öncelikli olan 0.0.Öncelik, kazanan bir çakışma algılandığında çekmek için varsayılan çözümleyici tarafından kullanılır.Genel aboneleri için yayımcı öncelik olduğu 100'den küçük, abonelik önceliği olmalıdır.

  • [ @sync_type=] 'sync_type'
    Is the subscription synchronization type.sync_typeis nvarchar(15), with a default of automatic.Olabilir Otomatik veya yok.If automatic, the schema and initial data for published tables are transferred to the Subscriber first.If none, it is assumed the Subscriber already has the schema and initial data for published tables.Sistem tablolarını ve veri her zaman transfer edilir.

    Not

    Değeri belirtme öneririz değil yok.Daha fazla bilgi için bkz: Birleştirme aboneliği olmayan bir Snapshot başlatılıyor.

  • [ @description=] 'description'
    Is a brief description of this pull subscription.descriptionis nvarchar(255), with a default of NULL.Bu değer tarafından çoğaltma İzleyicisi'nde görüntülenen Kolay ad izlenen yayın aboneliklerinin sıralamakta kullanılan sütun.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (başarısız)

Açıklamalar

sp_addmergepullsubscription birleştirmek için kullanılan çoğaltma.

Kullanarak, SQL Server Abonelik eşitlemek için Aracısı sp_addmergepullsubscription_agent saklı yordam bir aracı ve iş yayını ile eşitlemek için oluşturmak için abone adresindeki çalıştırmalısınız.

Örnek

-- This script uses sqlcmd scripting variables. They are in the form
-- $(MyVariable). 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".

-- Execute this batch at the Subscriber.
DECLARE @publication AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publicationDB AS sysname;
DECLARE @hostname AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @publisher = $(PubServer);
SET @publicationDB = N'AdventureWorks2008R2';
SET @hostname = N'adventure-works\david8';

-- At the subscription database, create a pull subscription 
-- to a merge publication.
USE [AdventureWorks2008R2Replica]
EXEC sp_addmergepullsubscription 
  @publisher = @publisher, 
  @publication = @publication, 
  @publisher_db = @publicationDB;

-- Add an agent job to synchronize the pull subscription. 
EXEC sp_addmergepullsubscription_agent 
  @publisher = @publisher, 
  @publisher_db = @publicationDB, 
  @publication = @publication, 
  @distributor = @publisher, 
  @job_login = $(Login), 
  @job_password = $(Password),
  @hostname = @hostname;
GO
-- This script uses sqlcmd scripting variables. They are in the form
-- $(MyVariable). 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".

-- Publication must support anonymous Subscribers.
-- Execute this batch at the Subscriber.
DECLARE @publication AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publicationDB AS sysname;
DECLARE @websyncurl AS sysname;
DECLARE @security_mode AS int;
DECLARE @login AS sysname;
DECLARE @password AS nvarchar(512);
SET @publication = N'AdvWorksSalesOrdersMergeWebSync';
SET @publisher = $(PubServer);
SET @publicationDB = N'AdventureWorks2008R2';
SET @websyncurl = 'https://' + $(WebServer) + '/WebSync';
SET @security_mode = 0; -- Basic Authentication for IIS
SET @login = $(Login);
SET @password = $(Password);

-- At the subscription database, create a pull subscription 
-- to a merge publication.
USE [AdventureWorks2008R2Replica]
EXEC sp_addmergepullsubscription 
    @publisher = @publisher, 
    @publication = @publication, 
    @publisher_db = @publicationDB,
    @subscriber_type = N'anonymous';

-- Add an agent job to synchronize the pull subscription. 
EXEC sp_addmergepullsubscription_agent 
    @publisher = @publisher, 
    @publisher_db = @publicationDB, 
    @publication = @publication, 
    @distributor = @publisher, 
    @job_login = @login, 
    @job_password = @password,
    @use_web_sync = 1,
    @internet_security_mode = @security_mode,
    @internet_url = @websyncurl,
    @internet_login = @login,
    @internet_password = @password;
GO

İzinler

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