sp_dropmergepullsubscription (Transact-SQL)

適用対象:SQL Server

マージ プル サブスクリプションを削除します。 このストアド プロシージャは、サブスクリプション データベースのサブスクライバーで実行されます。

Transact-SQL 構文表記規則

構文

sp_dropmergepullsubscription
    [ [ @publication = ] N'publication' ]
    [ , [ @publisher = ] N'publisher' ]
    [ , [ @publisher_db = ] N'publisher_db' ]
    [ , [ @reserved = ] reserved ]
[ ; ]

引数

[ @publication = ] N'publication'

出版物の名前。 @publicationは sysname で、既定値は NULL. このパラメーターは必須です。 すべてのパブリケーションの all サブスクリプションを削除する値を指定します。

[ @publisher = ] N'publisher'

パブリッシャーの名前。 @publisherは sysname で、既定値は NULL. このパラメーターは必須です。

[ @publisher_db = ] N'publisher_db'

パブリッシャー データベースの名前。 @publisher_dbは sysname で、既定値は NULL. このパラメーターは必須です。

[ @reserved = ] 予約済み

将来利用するために予約されています。 @reservedはビットで、既定値は 0.

リターン コードの値

0 (成功) または 1 (失敗)。

解説

sp_dropmergepullsubscription はマージ レプリケーションで使用されます。

sp_dropmergepullsubscriptionではマージ エージェントは作成sp_addmergepullsubscriptionされませんが、このマージ プル サブスクリプションのマージ エージェントは削除されます。

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

USE [AdventureWorks2022Replica]
EXEC sp_dropmergepullsubscription 
  @publisher = @publisher, 
  @publisher_db = @publication_db, 
  @publication = @publication;
GO

アクセス許可

sysadmin 固定サーバー ロールのメンバーまたはマージ プル サブスクリプションを作成したユーザーのみが実行sp_dropmergepullsubscriptionできます。 db_owner固定データベース ロールは、マージ プル サブスクリプションを作成したユーザーがこのロールに属している場合にのみ実行sp_dropmergepullsubscriptionできます。