sp_mergearticlecolumn(Transact-SQL)

적용 대상:SQL Server

병합 게시를 세로로 분할합니다. 이 저장 프로시저는 게시 데이터베이스의 게시자에서 실행됩니다.

Transact-SQL 구문 표기 규칙

구문

sp_mergearticlecolumn
    [ @publication = ] N'publication'
    , [ @article = ] N'article'
    [ , [ @column = ] N'column' ]
    [ , [ @operation = ] N'operation' ]
    [ , [ @schema_replication = ] N'schema_replication' ]
    [ , [ @force_invalidate_snapshot = ] force_invalidate_snapshot ]
    [ , [ @force_reinit_subscription = ] force_reinit_subscription ]
[ ; ]

인수

[ @publication = ] N'publication'

게시의 이름입니다. @publication 기본값이 없는 sysname입니다.

[ @article = ] N'article'

발행물에 있는 아티클의 이름입니다. @article 기본값이 없는 sysname입니다.

[ @column = ] N'column'

수직 분할을 만들 열을 식별합니다. @column sysname이며 기본값은 .입니다NULL. @operation 설정add되면 NULL 원본 테이블의 모든 열이 기본적으로 아티클에 추가됩니다. @column @operation 설정된 drop경우 NULL 수 없습니다. 아티클에서 열을 제외하려면 @column 실행하고 지정한 @article 제거할 각 열로 설정합니다 @operationdrop.sp_mergearticlecolumn

[ @operation = ] N'operation'

복제본(replica)tion 상태. @operation 기본값add인 nvarchar(4)입니다.

  • add는 복제본(replica) 열을 표시합니다.
  • drop 열을 지웁니다.

[ @schema_replication = ] N'schema_복제본(replica)tion'

병합 에이전트 실행될 때 스키마 변경 내용이 전파되도록 지정합니다. @schema_복제본(replica)tion은 기본값false인 nvarchar(5)입니다.

false@schema_복제본(replica) 경우에만 지원됩니다.

[ @force_invalidate_snapshot = ] force_invalidate_스냅샷

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

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

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

[ @force_reinit_subscription = ] force_reinit_subscription

구독을 다시 초기화하는 기능을 사용하거나 사용하지 않도록 설정합니다. @force_reinit_subscription 비트이며 기본값은 .입니다0.

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

  • 1 는 병합 아티클을 변경하면 구독이 다시 초기화될 수 있으며, 이 경우 구독 다시 초기화에 대한 권한을 부여하는 값 1 이 지정됩니다.

반환 코드 값

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

설명

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

자동 ID 범위 관리를 사용하는 경우 아티클에서 ID 열을 삭제할 수 없습니다. 자세한 내용은 ID 열 복제를 참조하세요.

초기 스냅샷 만든 후 애플리케이션이 새 세로 파티션을 설정하는 경우 새 스냅샷 생성하고 각 구독에 다시 적용해야 합니다. 스냅샷은 예약된 다음 스냅샷 배포 또는 병합 에이전트가 실행될 때 적용됩니다.

행 추적을 충돌 감지(기본값)에 사용하는 경우 기본 테이블에는 최대 1,024개의 열이 포함될 수 있지만, 최대 246개의 열이 게시되도록 아티클에서 열을 필터링해야 합니다. 열 추적을 사용하는 경우 기본 테이블에는 최대 246개의 열이 포함될 수 있습니다.

예제

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()';

-- Add a filtered article for the Employee table.
EXEC sp_addmergearticle 
  @publication = @publication, 
  @article = @table1, 
  @source_object = @table1, 
  @type = N'table', 
  @source_owner = @hrschema,
  @schema_option = 0x0004CF1,
  @description = N'article for the Employee table',
  @subset_filterclause = @filterclause;

-- Add an article for the SalesOrderHeader table that is filtered
-- based on Employee and horizontally filtered.
EXEC sp_addmergearticle 
  @publication = @publication, 
  @article = @table2, 
  @source_object = @table2, 
  @type = N'table', 
  @source_owner = @salesschema, 
  @vertical_partition = N'true',
  @schema_option = 0x0034EF1,
  @description = N'article for the SalesOrderDetail table';

-- Add an article for the SalesOrderDetail table that is filtered
-- based on SaledOrderHeader.
EXEC sp_addmergearticle 
  @publication = @publication, 
  @article = @table3, 
  @source_object = @table3, 
  @source_owner = @salesschema,
  @description = 'article for the SalesOrderHeader table', 
  @identityrangemanagementoption = N'auto', 
  @pub_identity_range = 100000, 
  @identity_range = 100, 
  @threshold = 80,
  @schema_option = 0x0004EF1;

-- Add all columns to the SalesOrderHeader article.
EXEC sp_mergearticlecolumn 
  @publication = @publication, 
  @article = @table2, 
  @force_invalidate_snapshot = 1, 
  @force_reinit_subscription = 1;

-- Remove the credit card Approval Code column.
EXEC sp_mergearticlecolumn 
  @publication = @publication, 
  @article = @table2, 
  @column = N'CreditCardApprovalCode', 
  @operation = N'drop', 
  @force_invalidate_snapshot = 1, 
  @force_reinit_subscription = 1;

-- Add a merge join filter between Employee and SalesOrderHeader.
EXEC sp_addmergefilter 
  @publication = @publication, 
  @article = @table2, 
  @filtername = N'SalesOrderHeader_Employee', 
  @join_articlename = @table1, 
  @join_filterclause = N'Employee.BusinessEntityID = SalesOrderHeader.SalesPersonID', 
  @join_unique_key = 1, 
  @filter_type = 1, 
  @force_invalidate_snapshot = 1, 
  @force_reinit_subscription = 1;

-- Add a merge join filter between SalesOrderHeader and SalesOrderDetail.
EXEC sp_addmergefilter 
  @publication = @publication, 
  @article = @table3, 
  @filtername = N'SalesOrderDetail_SalesOrderHeader', 
  @join_articlename = @table2, 
  @join_filterclause = N'SalesOrderHeader.SalesOrderID = SalesOrderDetail.SalesOrderID', 
  @join_unique_key = 1, 
  @filter_type = 1, 
  @force_invalidate_snapshot = 1, 
  @force_reinit_subscription = 1;
GO

사용 권한

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