sp_dropmergearticle(Transact-SQL)

적용 대상:SQL Server

병합 게시에서 아티클을 제거합니다. 이 저장 프로시저는 게시 데이터베이스의 게시자에서 실행됩니다.

Transact-SQL 구문 표기 규칙

구문

sp_dropmergearticle
    [ @publication = ] N'publication'
    , [ @article = ] N'article'
    [ , [ @ignore_distributor = ] ignore_distributor ]
    [ , [ @reserved = ] reserved ]
    [ , [ @force_invalidate_snapshot = ] force_invalidate_snapshot ]
    [ , [ @force_reinit_subscription = ] force_reinit_subscription ]
    [ , [ @ignore_merge_metadata = ] ignore_merge_metadata ]
[ ; ]

인수

[ @publication = ] N'publication'

아티클을 삭제할 게시의 이름입니다. @publication 기본값이 없는 sysname입니다.

[ @article = ] N'article'

지정된 발행물에서 삭제할 아티클의 이름입니다. @article 기본값이 없는 sysname입니다. 이 경우 all지정된 병합 게시의 모든 기존 아티클이 제거됩니다. @articleall경우에도 아티클과 별도로 게시를 삭제해야 합니다.

[ @ignore_distributor = ] ignore_distributor

이 저장 프로시저가 배포자에 연결되지 않고 실행되는지 여부를 표시합니다. @ignore_distributor 비트이며 기본값은 .입니다0.

[ @reserved = ] 예약됨

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

[ @force_invalidate_snapshot = ] force_invalidate_스냅샷

스냅샷 무효화 기능을 설정하거나 해제합니다. @force_invalidate_스냅샷 비트이며 기본값은 .입니다0.

  • 0는 병합 아티클을 변경해도 스냅샷 유효하지 않도록 지정합니다.

  • 1는 병합 아티클을 변경하면 스냅샷 유효하지 않을 수 있으며, 이 경우 값 1 이 새 스냅샷 발생할 수 있는 권한을 부여합니다.

[ @force_reinit_subscription = ] force_reinit_subscription

아티클을 삭제하려면 기존 구독을 다시 초기화해야 합니다. @force_reinit_subscription 비트이며 기본값은 .입니다0.

  • 0 는 아티클을 삭제해도 구독이 다시 초기화되지 않도록 지정합니다.

  • 1 는 아티클을 삭제하면 기존 구독이 다시 초기화되고 구독 다시 초기화가 발생할 수 있는 권한을 부여합니다.

[ @ignore_merge_metadata = ] ignore_merge_metadata

정보를 제공하기 위해서만 확인됩니다. 지원 안 됨 향후 호환성은 보장되지 않습니다.

반환 코드 값

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

설명

sp_dropmergearticle는 병합 복제본(replica)에 사용됩니다. 아티클 삭제에 대한 자세한 내용은 기존 게시에 아티클 추가 및 삭제를 참조하세요.

sp_dropmergearticle 게시에서 아티클을 삭제하기 위해 실행하면 구독 데이터베이스에서 게시 데이터베이스 또는 해당 개체에서 개체가 제거되지 않습니다. 필요한 경우 이러한 개체를 수동으로 제거하는 데 사용합니다 DROP <object> .

사용 권한

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

예제

이 문서에는 AdventureWorks2022 Microsoft SQL Server 샘플 및 커뮤니티 프로젝트 홈페이지에서 다운로드할 수 있는 샘플 데이터베이스가 필요합니다.

A. 병합 게시에서 아티클 제거

USE [AdventureWorks2022];
GO

DECLARE @publication AS SYSNAME;
DECLARE @article1 AS SYSNAME;
DECLARE @article2 AS SYSNAME;

SET @publication = N'AdvWorksSalesOrdersMerge';
SET @article1 = N'SalesOrderDetail';
SET @article2 = N'SalesOrderHeader';

EXEC sp_dropmergearticle @publication = @publication,
    @article = @article1,
    @force_invalidate_snapshot = 1;

EXEC sp_dropmergearticle @publication = @publication,
    @article = @article2,
    @force_invalidate_snapshot = 1;
GO
USE [AdventureWorks2022];
GO

DECLARE @publication AS SYSNAME;
DECLARE @table1 AS SYSNAME;
DECLARE @table2 AS SYSNAME;
DECLARE @table3 AS SYSNAME;
DECLARE @salesschema AS SYSNAME;
DECLARE @hrschema AS SYSNAME;
DECLARE @filterclause AS NVARCHAR(1000);

SET @publication = N'AdvWorksSalesOrdersMerge';
SET @table1 = N'Employee';
SET @table2 = N'SalesOrderHeader';
SET @table3 = N'SalesOrderDetail';
SET @salesschema = N'Sales';
SET @hrschema = N'HumanResources';
SET @filterclause = N'Employee.LoginID = HOST_NAME()';

-- Drop the merge join filter between SalesOrderHeader and SalesOrderDetail.
EXEC sp_dropmergefilter @publication = @publication,
    @article = @table3,
    @filtername = N'SalesOrderDetail_SalesOrderHeader',
    @force_invalidate_snapshot = 1,
    @force_reinit_subscription = 1;

-- Drop the merge join filter between Employee and SalesOrderHeader.
EXEC sp_dropmergefilter @publication = @publication,
    @article = @table2,
    @filtername = N'SalesOrderHeader_Employee',
    @force_invalidate_snapshot = 1,
    @force_reinit_subscription = 1;

-- Drop the article for the SalesOrderDetail table.
EXEC sp_dropmergearticle @publication = @publication,
    @article = @table3,
    @force_invalidate_snapshot = 1,
    @force_reinit_subscription = 1;

-- Drop the article for the SalesOrderHeader table.
EXEC sp_dropmergearticle @publication = @publication,
    @article = @table2,
    @force_invalidate_snapshot = 1,
    @force_reinit_subscription = 1;

-- Drop the article for the Employee table.
EXEC sp_dropmergearticle @publication = @publication,
    @article = @table1,
    @force_invalidate_snapshot = 1,
    @force_reinit_subscription = 1;
GO