sp_dropmergesubscription (Transact-SQL)

卸除對於合併式發行集及其相關聯合併代理程式的訂閱。 這個預存程序執行於發行集資料庫的發行者端。

主題連結圖示 Transact-SQL 語法慣例

語法

sp_dropmergesubscription [ [ @publication= ] 'publication' ] 
    [ , [ @subscriber= ] 'subscriber'  
    [ , [ @subscriber_db= ] 'subscriber_db' ] 
    [ , [ @subscription_type= ] 'subscription_type' ] 
    [ , [ @ignore_distributor = ] ignore_distributor ] 
    [ , [ @reserved = ] reserved ]

引數

  • [ @publication= ] 'publication'
    這是發行集名稱。 publication 是 sysname,預設值是 NULL。 發行集必須已存在,且符合識別碼的規則。

  • [ @subscriber=] 'subscriber'
    這是訂閱者的名稱。 subscriber 是 sysname,預設值是 NULL。

  • [ @subscriber_db= ] 'subscriber_db'
    這是訂閱資料庫的名稱。 subscription_database 是 sysname,預設值是 NULL。

  • [ @subscription_type= ] 'subscription_type'
    這是訂閱的類型。 subscription_type 是 nvarchar(15),而且可以是下列其中一個值。

    說明

    all

    發送、提取和匿名訂閱

    anonymous

    匿名訂閱。

    push

    發送訂閱。

    pull

    提取訂閱。

    both (預設值)

    發送和提取訂閱。

  • [ @ignore_distributor = ] ignore_distributor
    指出是否在未連接到散發者的情況之下,執行這個預存程序。 ignore_distributor 是 bit,預設值是 0。 這個參數可在不執行散發者清除工作的情況下,用來卸除訂閱。 如果您必須重新安裝散發者,它也很有用。

  • [ @reserved= ] reserved
    保留供日後使用。 reserved 是 bit,預設值是 0

傳回碼值

0 (成功) 或 1 (失敗)

備註

sp_dropmergesubscription 用於合併式複寫中。

範例

-- 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'AdventureWorks2012Replica';

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

權限

只有系統管理員 (sysadmin) 固定伺服器角色或 db_owner 固定資料庫角色的成員,才能夠執行 sp_dropmergesubscription

請參閱

參考

sp_addmergesubscription (Transact-SQL)

sp_changemergesubscription (Transact-SQL)

sp_helpmergesubscription (Transact-SQL)

概念

刪除發送訂閱

刪除提取訂閱