次の方法で共有


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 です。

解説

sp_dropmergesubscription は、マージ レプリケーションで使用します。

権限

sp_dropmergesubscription を実行できるのは、固定サーバー ロール sysadmin または固定データベース ロール db_owner のメンバだけです。

戻り値

成功した場合は 0 を、失敗した場合は 1 をそれぞれ返します。

使用例

-- 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)

その他の技術情報

プッシュ サブスクリプションを削除する方法 (レプリケーション Transact-SQL プログラミング)
プル サブスクリプションを削除する方法 (レプリケーション Transact-SQL プログラミング)

ヘルプおよび情報

SQL Server 2005 の参考資料の入手