Share via


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'
    這是發行集名稱。publicationsysname,預設值是 NULL。發行集必須已存在,且符合識別碼的規則。
  • [ @subscriber=] 'subscriber'
    這是訂閱者的名稱。subscribersysname,預設值是 NULL。
  • [ @subscriber_db=] 'subscriber_db'
    這是訂閱資料庫的名稱。subscription_databasesysname,預設值是 NULL。
  • [ @subscription_type=] 'subscription_type'
    這是訂閱的類型。subscription_typenvarchar(15),它可以是下列值之一。

    描述

    all

    發送、提取和匿名訂閱

    anonymous

    匿名訂閱。

    push

    發送訂閱。

    pull

    提取訂閱。

    both (預設值)

    發送和提取訂閱。

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

傳回碼值

0 (成功) 或 1 (失敗)

備註

sp_dropmergesubscription 用於合併式複寫中。

權限

只有系統管理員 (sysadmin) 固定伺服器角色或 db_owner 固定資料庫角色的成員,才能夠執行 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'AdventureWorksReplica';

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

請參閱

參考

sp_addmergesubscription (Transact-SQL)
sp_changemergesubscription (Transact-SQL)
sp_helpmergesubscription (Transact-SQL)

其他資源

How to: Delete a Push Subscription (Replication Transact-SQL Programming)
How to: Delete a Pull Subscription (Replication Transact-SQL Programming)

說明及資訊

取得 SQL Server 2005 協助