Aracılığıyla paylaş


Nasıl yapılır: Çekme abonelik (çoğaltma Transact-SQL programlama) Sil

Çekme abonelikleri çoğaltma depolanmış yordamları kullanarak programsal silinebilir.Kullanılan saklı yordamlar abonelik ait olduğu yayın türüne bağlıdır.

Bir anlık görüntü veya işlem yayın için istek temelli abonelik silmek için

  1. Üzerinde abone adresindeki abonelik veritabanı, execute sp_droppullsubscription (Transact-sql).Belirtmek @ yayın, @ publisher, ve @ publisher_db.

  2. yayın veritabanı üzerinde Yayımcı tarafında yürütmek sp_dropsubscription (Transact-sql).Belirtmek @ yayın ve @ abone.Bir değer belirtmek tüm için @ makale.(İsteğe bağlı) Dağıtımcı erişilemiyorsa, değeri belirtmek 1 için @ ignore_distributor abonelik dağıtımcı adresindeki ilgili nesneleri kaldırmadan silmek için.

Bir mektup birleştirme istek temelli abonelik silmek içinyayın

  1. Üzerinde abone adresindeki abonelik veritabanı, execute sp_dropmergepullsubscription (Transact-sql).Belirtmek @ yayın, @ publisher, ve @ publisher_db.

  2. yayın veritabanı üzerinde Yayımcı tarafında yürütmek sp_dropmergesubscription (Transact-sql).Belirtmek @ yayın, @ abone, ve @ subscriber_db.Bir değer belirtmek çekme için @ subscription_type.(İsteğe bağlı) Dağıtımcı erişilemiyorsa, değeri belirtmek 1 için @ ignore_distributor abonelik dağıtımcı adresindeki ilgili nesneleri kaldırmadan silmek için.

Örnek

Aşağıdaki örnek, bir istek temelli abonelik için bir işlem siler yayın.İlk toplu iş iş Abone tarafında yürütülür ve ikinci Yayımcı tarafında yürütülür.

-- 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".

-- This is the batch executed at the Subscriber to drop 
-- a pull subscription to a transactional publication.
DECLARE @publication AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publicationDB     AS sysname;
SET @publication = N'AdvWorksProductTran';
SET @publisher = $(PubServer);
SET @publicationDB = N'AdventureWorks2008R2';

USE [AdventureWorks2008R2Replica]
EXEC sp_droppullsubscription 
  @publisher = @publisher, 
  @publisher_db = @publicationDB, 
  @publication = @publication;
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".

-- This batch is executed at the Publisher to remove 
-- a pull or push subscription to a transactional publication.
DECLARE @publication AS sysname;
DECLARE @subscriber AS sysname;
SET @publication = N'AdvWorksProductTran';
SET @subscriber = $(SubServer);

USE [AdventureWorks2008R2;]
EXEC sp_dropsubscription 
  @publication = @publication, 
  @article = N'all',
  @subscriber = @subscriber;
GO

Aşağıdaki örnek, bir istek temelli abonelik birleştirme için siler yayın.İlk toplu iş iş Abone tarafında yürütülür ve ikinci Yayımcı tarafında yürütülür.

-- 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".

-- This batch is executed at the Subscriber to remove 
-- a merge pull subscription.
DECLARE @publication AS sysname;
DECLARE @publisher AS sysname;
DECLARE @publication_db AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @publisher = $(PubServer);
SET @publication_db = N'AdventureWorks2008R2';

USE [AdventureWorks2008R2Replica]
EXEC sp_dropmergepullsubscription 
  @publisher = @publisher, 
  @publisher_db = @publication_db, 
  @publication = @publication;
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".

-- This batch is executed at the Publisher to remove 
-- a pull or push subscription to a merge publication.
DECLARE @publication AS sysname;
DECLARE @subscriber AS sysname;
DECLARE @subscriptionDB AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @subscriber = $(SubServer);
SET @subscriptionDB = N'AdventureWorks2008R2Replica';

USE [AdventureWorks2008R2]
EXEC sp_dropmergesubscription 
  @publication = @publication, 
  @subscriber = @subscriber, 
  @subscriber_db = @subscriptionDB;
GO