아티클 정의

이 항목에서는 SQL Server Management Studio, Transact-SQL 또는 RMO(복제 관리 개체)를 사용하여 SQL Server 2012에서 아티클을 정의하는 방법에 대해 설명합니다.

항목 내용

  • 시작하기 전 주의 사항

    제한 사항

    보안

  • 아티클을 정의하려면:

    SQL Server Management Studio

    Transact-SQL

    RMO(복제 관리 개체)

시작하기 전 주의 사항

제한 사항

  • 아티클 이름에는 다음 문자를 사용할 수 없습니다. % , * , [ , ] , | , : , " , ? , ' , \ , / , < , >. 이러한 문자를 포함하는 데이터베이스 개체를 복제하려면 개체 이름과 다른 아티클 이름을 지정해야 합니다.

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

보안

가능한 경우 런타임 시 사용자에게 보안 자격 증명을 입력하라는 메시지를 표시합니다. 자격 증명을 저장해야 하는 경우 Microsoft Windows .NET Framework에서 제공하는 암호화 서비스를 사용합니다.

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

SQL Server Management Studio 사용

새 게시 마법사를 사용하여 게시를 만들고 아티클을 정의할 수 있습니다. 게시를 만든 다음 게시 속성 - <Publication> 대화 상자에서 게시 속성을 보고 수정합니다. Oracle에서 데이터베이스 게시를 만드는 방법은 Oracle 데이터베이스에서 게시 만들기를 참조하십시오.

게시를 만들고 아티클을 정의하려면

  1. Microsoft SQL Server Management Studio에서 게시자에 연결한 다음 해당 서버 노드를 확장합니다.

  2. 복제 폴더를 확장한 다음 로컬 게시 폴더를 마우스 오른쪽 단추로 클릭합니다.

  3. 새 게시를 클릭합니다.

  4. 새 게시 마법사의 페이지에 따라 다음을 수행하십시오.

    • 서버에 배포가 구성되어 있지 않은 경우 배포자를 지정합니다. 배포 구성에 대한 자세한 내용은 게시 및 배포 구성을 참조하십시오.

      배포자 페이지에서 게시자 서버가 자신의 고유 배포자(로컬 배포자) 역할을 하는 것으로 지정했지만 서버가 배포자로 구성되어 있지 않은 경우 새 게시 마법사가 서버를 구성합니다. 스냅숏 폴더 페이지에서 배포자에 대해 기본 스냅숏 폴더를 지정하게 됩니다. 스냅숏 폴더는 공유하도록 지정된 디렉터리일 뿐이며 이 폴더에 읽기/쓰기 작업을 수행하려면 에이전트에게 충분한 액세스 권한이 있어야 합니다. 폴더에 보안을 설정하는 방법은 스냅숏 폴더 보안 설정을 참조하십시오.

      다른 서버가 배포자의 역할을 하도록 지정한 경우 게시자에서 배포자로 연결할 때 사용할 암호를 관리 암호 페이지에 입력해야 합니다. 이 암호는 원격 배포자에서 게시자를 설정할 때 지정한 암호와 일치해야 합니다.

      자세한 내용은 배포 구성을 참조하십시오.

    • 게시 데이터베이스를 선택합니다.

    • 보고서 유형을 선택합니다. 자세한 내용은 복제 유형를 참조하십시오.

    • 게시할 데이터와 데이터베이스 개체를 지정합니다. 필요에 따라 테이블 아티클에서 열을 필터링하고 아티클 속성을 설정합니다.

    • 필요에 따라 테이블 아티클에서 행을 필터링합니다. 자세한 내용은 게시된 데이터 필터링을 참조하십시오.

    • 스냅숏 에이전트 일정을 설정합니다.

    • 다음 복제 에이전트를 실행 및 연결하는 자격 증명을 지정합니다.

      - 모든 게시에 대한 스냅숏 에이전트

      - 모든 트랜잭션 게시에 대한 로그 판독기 에이전트

      - 구독 업데이트를 허용하는 트랜잭션 게시에 대한 큐 판독기 에이전트

      자세한 내용은 복제 에이전트 보안 모델복제 보안을 위한 최선의 구현 방법을 참조하십시오.

    • 필요에 따라 게시를 스크립팅합니다. 자세한 내용은 복제 스크립팅을 참조하십시오.

    • 게시의 이름을 지정합니다.

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

Transact-SQL 사용

게시를 만든 후에 복제 저장 프로시저를 사용하여 아티클을 프로그래밍 방식으로 만들 수 있습니다. 아티클을 만드는 데 사용되는 저장 프로시저는 정의하려는 아티클의 게시 유형에 따라 달라집니다. 자세한 내용은 게시 만들기를 참조하십시오.

스냅숏 또는 트랜잭션 게시에 대한 아티클을 정의하려면

  1. 게시 데이터베이스의 게시자에서 sp_addarticle을 실행합니다. @publication에 아티클이 속한 게시의 이름을, @article에 아티클 이름을, @source_object에 게시할 데이터베이스 개체를 지정하고, 그 밖의 선택적 매개 변수를 지정합니다. dbo가 아닌 경우 @source_owner를 사용하여 개체의 스키마 소유권을 지정합니다. 로그 기반 테이블 아티클이 아니라면 @type에 아티클 유형을 지정합니다. 자세한 내용은 아티클 유형 정의(복제 Transact-SQL 프로그래밍)를 참조하십시오.

  2. 테이블의 행을 행 필터링하거나 아티클을 보려면 sp_articlefilter를 사용하여 필터 절을 정의합니다. 자세한 내용은 정적 행 필터 정의 및 수정을 참조하십시오.

  3. 테이블의 열을 열 필터링하거나 아티클을 보려면 sp_articlecolumn을 사용합니다. 자세한 내용은 열 필터 정의 및 수정을 참조하십시오.

  4. 아티클이 필터링되었으면 sp_articleview를 실행합니다.

  5. 게시에 기존 구독이 있고 sp_helppublicationimmediate_sync 열에 값 0을 반환하면 sp_addsubscription을 호출하여 각각의 기존 구독에 아티클을 추가해야 합니다.

  6. 게시에 기존 끌어오기 구독이 있으면 게시자에서 sp_refreshsubscriptions를 실행하여 새 아티클을 포함하는, 기존 끌어오기 구독에 대한 새 스냅숏을 만듭니다.

    [!참고]

    스냅숏을 사용하여 초기화되지 않은 구독에 대해서는 sp_refreshsubscriptions를 실행하지 않아도 됩니다. 이 절차는 sp_addarticle에 의해 실행됩니다.

병합 게시에 대한 아티클을 정의하려면

  1. 게시 데이터베이스의 게시자에서 sp_addmergearticle을 실행합니다. @publication에 게시의 이름을, @article에 아티클 이름을, @source_object에 게시할 개체를 지정합니다. 테이블 행을 행 필터링하려면 @subset_filterclause에 값을 지정합니다. 자세한 내용은 병합 아티클에 대한 매개 변수가 있는 행 필터 정의 및 수정정적 행 필터 정의 및 수정을 참조하십시오. 테이블 아티클이 아니라면 @type에 아티클 유형을 지정합니다. 자세한 내용은 아티클 유형 정의(복제 Transact-SQL 프로그래밍)을 참조하십시오.

  2. 필요에 따라 게시 데이터베이스의 게시자에서 sp_addmergefilter를 실행하여 두 아티클 간의 조인 필터를 정의합니다. 자세한 내용은 병합 아티클 사이에서 조인 필터 정의 및 수정을 참조하십시오.

  3. 필요에 따라 게시 데이터베이스의 게시자에서 sp_mergearticlecolumn을 실행하여 테이블 열을 필터링합니다. 자세한 내용은 열 필터 정의 및 수정을 참조하십시오.

예(Transact-SQL)

이 예에서는 Product 테이블을 기반으로 트랜잭션 게시에 대한 아티클을 정의합니다. 여기에서 아티클은 행 및 열 방향으로 필터링됩니다.

DECLARE @publication    AS sysname;
DECLARE @table AS sysname;
DECLARE @filterclause AS nvarchar(500);
DECLARE @filtername AS nvarchar(386);
DECLARE @schemaowner AS sysname;
SET @publication = N'AdvWorksProductTran'; 
SET @table = N'Product';
SET @filterclause = N'[DiscontinuedDate] IS NULL'; 
SET @filtername = N'filter_out_discontinued';
SET @schemaowner = N'Production';

-- Add a horizontally and vertically filtered article for the Product table.
-- Manually set @schema_option to ensure that the Production schema 
-- is generated at the Subscriber (0x8000000).
EXEC sp_addarticle 
    @publication = @publication, 
    @article = @table, 
    @source_object = @table,
    @source_owner = @schemaowner, 
    @schema_option = 0x80030F3,
    @vertical_partition = N'true', 
    @type = N'logbased',
    @filter_clause = @filterclause;

-- (Optional) Manually call the stored procedure to create the 
-- horizontal filtering stored procedure. Since the type is 
-- 'logbased', this stored procedures is executed automatically.
EXEC sp_articlefilter 
    @publication = @publication, 
    @article = @table, 
    @filter_clause = @filterclause, 
    @filter_name = @filtername;

-- Add all columns to the article.
EXEC sp_articlecolumn 
    @publication = @publication, 
    @article = @table;

-- Remove the DaysToManufacture column from the article
EXEC sp_articlecolumn 
    @publication = @publication, 
    @article = @table, 
    @column = N'DaysToManufacture', 
    @operation = N'drop';

-- (Optional) Manually call the stored procedure to create the 
-- vertical filtering view. Since the type is 'logbased', 
-- this stored procedures is executed automatically.
EXEC sp_articleview 
    @publication = @publication, 
    @article = @table,
    @filter_clause = @filterclause;
GO

이 예에서는 병합 게시에 대한 아티클을 정의합니다. 여기에서 SalesOrderHeader 아티클은 SalesPersonID에 따라 정적으로 필터링되고 SalesOrderDetail 아티클은 SalesOrderHeader에 따라 조인 필터링됩니다.

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

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

RMO(복제 관리 개체) 사용

RMO(복제 관리 개체)를 사용하여 프로그래밍 방식으로 아티클을 정의할 수 있습니다. 아티클을 정의하는 데 사용하는 RMO 클래스는 정의되는 아티클의 게시 유형에 따라 달라집니다.

예(RMO)

다음 예에서는 행 및 열 필터가 포함된 아티클을 트랜잭션 게시에 추가합니다.

          // Define the Publisher, publication, and article names.
            string publisherName = publisherInstance;
            string publicationName = "AdvWorksProductTran";
            string publicationDbName = "AdventureWorks2012";
            string articleName = "Product";
            string schemaOwner = "Production";

            TransArticle article;

            // Create a connection to the Publisher.
            ServerConnection conn = new ServerConnection(publisherName);

            // Create a filtered transactional articles in the following steps:
            // 1) Create the  article with a horizontal filter clause.
            // 2) Add columns to or remove columns from the article.
            try
            {
                // Connect to the Publisher.
                conn.Connect();

                // Define a horizontally filtered, log-based table article.
                article = new TransArticle();
                article.ConnectionContext = conn;
                article.Name = articleName;
                article.DatabaseName = publicationDbName;
                article.SourceObjectName = articleName;
                article.SourceObjectOwner = schemaOwner;
                article.PublicationName = publicationName;
                article.Type = ArticleOptions.LogBased;
                article.FilterClause = "DiscontinuedDate IS NULL";

                // Ensure that we create the schema owner at the Subscriber.
                article.SchemaOption |= CreationScriptOptions.Schema;

                if (!article.IsExistingObject)
                {
                    // Create the article.
                    article.Create();
                }
                else
                {
                    throw new ApplicationException(String.Format(
                        "The article {0} already exists in publication {1}.",
                        articleName, publicationName));
                }

                // Create an array of column names to remove from the article.
                String[] columns = new String[1];
                columns[0] = "DaysToManufacture";

                // Remove the column from the article.
                article.RemoveReplicatedColumns(columns);
            }
            catch (Exception ex)
            {
                // Implement appropriate error handling here.
                throw new ApplicationException("The article could not be created.", ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Define the Publisher, publication, and article names.
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksProductTran"
Dim publicationDbName As String = "AdventureWorks2012"
Dim articleName As String = "Product"
Dim schemaOwner As String = "Production"

Dim article As TransArticle

' Create a connection to the Publisher.
Dim conn As ServerConnection = New ServerConnection(publisherName)

' Create a filtered transactional articles in the following steps:
' 1) Create the  article with a horizontal filter clause.
' 2) Add columns to or remove columns from the article.
Try
    ' Connect to the Publisher.
    conn.Connect()

    ' Define a horizontally filtered, log-based table article.
    article = New TransArticle()
    article.ConnectionContext = conn
    article.Name = articleName
    article.DatabaseName = publicationDbName
    article.SourceObjectName = articleName
    article.SourceObjectOwner = schemaOwner
    article.PublicationName = publicationName
    article.Type = ArticleOptions.LogBased
    article.FilterClause = "DiscontinuedDate IS NULL"

    ' Ensure that we create the schema owner at the Subscriber.
    article.SchemaOption = article.SchemaOption Or _
    CreationScriptOptions.Schema

    If Not article.IsExistingObject Then
        ' Create the article.
        article.Create()
    Else
        Throw New ApplicationException(String.Format( _
         "The article {0} already exists in publication {1}.", _
         articleName, publicationName))
    End If

    ' Create an array of column names to remove from the article.
    Dim columns() As String = New String(0) {}
    columns(0) = "DaysToManufacture"

    ' Remove the column from the article.
    article.RemoveReplicatedColumns(columns)
Catch ex As Exception
    ' Implement appropriate error handling here.
    Throw New ApplicationException("The article could not be created.", ex)
Finally
    conn.Disconnect()
End Try

다음 예에서는 병합 게시에 세 개의 아티클을 추가합니다. 이 아티클에는 열 필터가 포함되며, 두 개의 조인 필터를 사용하여 매개 변수가 있는 행 필터를 다른 아티클에 전파합니다.

         // Define the Publisher and publication names.
            string publisherName = publisherInstance;
            string publicationName = "AdvWorksSalesOrdersMerge";
            string publicationDbName = "AdventureWorks2012";

            // Specify article names.
            string articleName1 = "Employee";
            string articleName2 = "SalesOrderHeader";
            string articleName3 = "SalesOrderDetail";

            // Specify join filter information.
            string filterName12 = "SalesOrderHeader_Employee";
            string filterClause12 = "Employee.EmployeeID = " +
                "SalesOrderHeader.SalesPersonID";
            string filterName23 = "SalesOrderDetail_SalesOrderHeader";
            string filterClause23 = "SalesOrderHeader.SalesOrderID = " +
                "SalesOrderDetail.SalesOrderID";

            string salesSchema = "Sales";
            string hrSchema = "HumanResources";

            MergeArticle article1 = new MergeArticle();
            MergeArticle article2 = new MergeArticle();
            MergeArticle article3 = new MergeArticle();
            MergeJoinFilter filter12 = new MergeJoinFilter();
            MergeJoinFilter filter23 = new MergeJoinFilter();

            // Create a connection to the Publisher.
            ServerConnection conn = new ServerConnection(publisherName);

            // Create three merge articles that are horizontally partitioned
            // using a parameterized row filter on Employee.EmployeeID, which is 
            // extended to the two other articles using join filters. 
            try
            {
                // Connect to the Publisher.
                conn.Connect();

                // Create each article. 
                // For clarity, each article is defined separately. 
                // In practice, iterative structures and arrays should 
                // be used to efficiently create multiple articles.

                // Set the required properties for the Employee article.
                article1.ConnectionContext = conn;
                article1.Name = articleName1;
                article1.DatabaseName = publicationDbName;
                article1.SourceObjectName = articleName1;
                article1.SourceObjectOwner = hrSchema;
                article1.PublicationName = publicationName;
                article1.Type = ArticleOptions.TableBased;

                // Define the parameterized filter clause based on Hostname.
                article1.FilterClause = "Employee.LoginID = HOST_NAME()";

                // Set the required properties for the SalesOrderHeader article.
                article2.ConnectionContext = conn;
                article2.Name = articleName2;
                article2.DatabaseName = publicationDbName;
                article2.SourceObjectName = articleName2;
                article2.SourceObjectOwner = salesSchema;
                article2.PublicationName = publicationName;
                article2.Type = ArticleOptions.TableBased;

                // Set the required properties for the SalesOrderDetail article.
                article3.ConnectionContext = conn;
                article3.Name = articleName3;
                article3.DatabaseName = publicationDbName;
                article3.SourceObjectName = articleName3;
                article3.SourceObjectOwner = salesSchema;
                article3.PublicationName = publicationName;
                article3.Type = ArticleOptions.TableBased;

                if (!article1.IsExistingObject) article1.Create();
                if (!article2.IsExistingObject) article2.Create();
                if (!article3.IsExistingObject) article3.Create();

                // Select published columns for SalesOrderHeader.
                // Create an array of column names to vertically filter out.
                // In this example, only one column is removed.
                String[] columns = new String[1];

                columns[0] = "CreditCardApprovalCode";

                // Remove the column.
                article2.RemoveReplicatedColumns(columns);

                // Define a merge filter clauses that filter 
                // SalesOrderHeader based on Employee and 
                // SalesOrderDetail based on SalesOrderHeader. 

                // Parent article.
                filter12.JoinArticleName = articleName1;
                // Child article.
                filter12.ArticleName = articleName2;
                filter12.FilterName = filterName12;
                filter12.JoinUniqueKey = true;
                filter12.FilterTypes = FilterTypes.JoinFilter;
                filter12.JoinFilterClause = filterClause12;

                // Add the join filter to the child article.
                article2.AddMergeJoinFilter(filter12);

                // Parent article.
                filter23.JoinArticleName = articleName2;
                // Child article.
                filter23.ArticleName = articleName3;
                filter23.FilterName = filterName23;
                filter23.JoinUniqueKey = true;
                filter23.FilterTypes = FilterTypes.JoinFilter;
                filter23.JoinFilterClause = filterClause23;

                // Add the join filter to the child article.
                article3.AddMergeJoinFilter(filter23);
            }
            catch (Exception ex)
            {
                // Do error handling here and rollback the transaction.
                throw new ApplicationException(
                    "The filtered articles could not be created", ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Define the Publisher and publication names.
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2012"

' Specify article names.
Dim articleName1 As String = "Employee"
Dim articleName2 As String = "SalesOrderHeader"
Dim articleName3 As String = "SalesOrderDetail"

' Specify join filter information.
Dim filterName12 As String = "SalesOrderHeader_Employee"
Dim filterClause12 As String = "Employee.EmployeeID = " + _
    "SalesOrderHeader.SalesPersonID"
Dim filterName23 As String = "SalesOrderDetail_SalesOrderHeader"
Dim filterClause23 As String = "SalesOrderHeader.SalesOrderID = " + _
    "SalesOrderDetail.SalesOrderID"

Dim salesSchema As String = "Sales"
Dim hrSchema As String = "HumanResources"

Dim article1 As MergeArticle = New MergeArticle()
Dim article2 As MergeArticle = New MergeArticle()
Dim article3 As MergeArticle = New MergeArticle()
Dim filter12 As MergeJoinFilter = New MergeJoinFilter()
Dim filter23 As MergeJoinFilter = New MergeJoinFilter()

' Create a connection to the Publisher.
Dim conn As ServerConnection = New ServerConnection(publisherName)

' Create three merge articles that are horizontally partitioned
' using a parameterized row filter on Employee.EmployeeID, which is 
' extended to the two other articles using join filters. 
Try
    ' Connect to the Publisher.
    conn.Connect()

    ' Create each article. 
    ' For clarity, each article is defined separately. 
    ' In practice, iterative structures and arrays should 
    ' be used to efficiently create multiple articles.

    ' Set the required properties for the Employee article.
    article1.ConnectionContext = conn
    article1.Name = articleName1
    article1.DatabaseName = publicationDbName
    article1.SourceObjectName = articleName1
    article1.SourceObjectOwner = hrSchema
    article1.PublicationName = publicationName
    article1.Type = ArticleOptions.TableBased

    ' Define the parameterized filter clause based on Hostname.
    article1.FilterClause = "Employee.LoginID = HOST_NAME()"

    ' Set the required properties for the SalesOrderHeader article.
    article2.ConnectionContext = conn
    article2.Name = articleName2
    article2.DatabaseName = publicationDbName
    article2.SourceObjectName = articleName2
    article2.SourceObjectOwner = salesSchema
    article2.PublicationName = publicationName
    article2.Type = ArticleOptions.TableBased

    ' Set the required properties for the SalesOrderDetail article.
    article3.ConnectionContext = conn
    article3.Name = articleName3
    article3.DatabaseName = publicationDbName
    article3.SourceObjectName = articleName3
    article3.SourceObjectOwner = salesSchema
    article3.PublicationName = publicationName
    article3.Type = ArticleOptions.TableBased

    ' Create the articles, if they do not already exist.
    If article1.IsExistingObject = False Then
        article1.Create()
    End If
    If article2.IsExistingObject = False Then
        article2.Create()
    End If
    If article3.IsExistingObject = False Then
        article3.Create()
    End If

    ' Select published columns for SalesOrderHeader.
    ' Create an array of column names to vertically filter out.
    ' In this example, only one column is removed.
    Dim columns() As String = New String(0) {}

    columns(0) = "CreditCardApprovalCode"

    ' Remove the column.
    article2.RemoveReplicatedColumns(columns)

    ' Define a merge filter clauses that filter 
    ' SalesOrderHeader based on Employee and 
    ' SalesOrderDetail based on SalesOrderHeader. 

    ' Parent article.
    filter12.JoinArticleName = articleName1
    ' Child article.
    filter12.ArticleName = articleName2
    filter12.FilterName = filterName12
    filter12.JoinUniqueKey = True
    filter12.FilterTypes = FilterTypes.JoinFilter
    filter12.JoinFilterClause = filterClause12

    ' Add the join filter to the child article.
    article2.AddMergeJoinFilter(filter12)

    ' Parent article.
    filter23.JoinArticleName = articleName2
    ' Child article.
    filter23.ArticleName = articleName3
    filter23.FilterName = filterName23
    filter23.JoinUniqueKey = True
    filter23.FilterTypes = FilterTypes.JoinFilter
    filter23.JoinFilterClause = filterClause23

    ' Add the join filter to the child article.
    article3.AddMergeJoinFilter(filter23)

Catch ex As Exception
    ' Do error handling here and rollback the transaction.
    Throw New ApplicationException( _
        "The filtered articles could not be created", ex)
Finally
    conn.Disconnect()
End Try

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

참고 항목

개념

게시 만들기

복제 시스템 저장 프로시저 개념

기존 게시에 대한 아티클 추가 및 삭제

게시된 데이터 필터링

데이터 및 데이터베이스 개체 게시

복제 시스템 저장 프로시저 개념