sp_dropmergesubscription(Transact-SQL)

적용 대상:SQL Server

병합 게시에 대한 구독 및 연결된 병합 에이전트를 삭제합니다. 이 저장 프로시저는 게시 데이터베이스의 게시자에서 실행됩니다.

Transact-SQL 구문 표기 규칙

구문

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

인수

[ @publication = ] N'publication'

게시 이름입니다. @publication sysname이며 기본값은 .입니다NULL. 게시가 이미 있어야 하며 식별자에 대한 규칙을 준수해야 합니다.

[ @subscriber = ] N'subscriber'

구독자의 이름입니다. @subscriber sysname이며 기본값은 .입니다NULL.

[ @subscriber_db = ] N'subscriber_db'

구독 데이터베이스의 이름입니다. @subscriber_db sysname이며 기본값은 .입니다NULL.

[ @subscription_type = ] N'subscription_type'

구독 유형입니다. @subscription_type nvarchar(15)이며 이러한 값 중 하나일 수 있습니다.

설명
all 밀어넣기, 끌어오기 및 익명 구독
anonymous 익명 구독.
push 밀어넣기 구독입니다.
pull 끌어오기 구독.
both (기본값) 밀어넣기 및 끌어오기 구독 모두.

[ @ignore_distributor = ] ignore_distributor

이 저장 프로시저가 배포자에 연결되지 않고 실행되는지 여부를 표시합니다. @ignore_distributor 비트이며 기본값은 .입니다0. 이 매개 변수는 배포자에서 클린up 작업을 수행하지 않고 구독을 삭제하는 데 사용할 수 있습니다. 배포자를 다시 설치해야 하는 경우에도 유용합니다.

[ @reserved = ] 예약됨

향후 사용을 위해 예약되어 있습니다. @reserved 비트이며 기본값은 .입니다0.

반환 코드 값

0 (성공) 또는 1 (실패).

설명

sp_dropmergesubscription는 병합 복제본(replica)에 사용됩니다.

예제

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

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

사용 권한

sysadmin 고정 서버 역할 또는 db_owner 고정 데이터베이스 역할의 멤버만 실행할 sp_dropmergesubscription수 있습니다.