Aracılığıyla paylaş


sp_mergearticlecolumn (Transact-SQL)

Bir birleştirme yayın dikey bölümleri.Bu saklı yordam, yayın veritabanı üzerinde yayımcı adresindeki yürütülür.

Konu bağlantısı simgesiTransact-sql sözdizimi kuralları

Sözdizimi

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

Bağımsız değişkenler

  • [ @publication =] 'publication'
    Is the name of the publication.Publication is sysname, with no default.

  • [ @article =] 'article'
    Is the name of the article in the publication.article is sysname, with no default.

  • [ @column =] 'column'
    Identifies the columns on which to create the vertical partition.column is sysname, with a default of NULL.If NULL and @operation = N'add', all columns in the source table are added to the article by default.column cannot be NULL when operation is set to drop.Sütunlarından dışlamak için bir makale, yürütmek sp_mergemakalesütun ve column ve @operation = N'drop' kaldırılacak her sütun için belirtilen'den article.

  • [ @operation =] 'operation'
    Is the replication status.operation is nvarchar(4), with a default of ADD.add marks the column for replication.drop clears the column.

  • [ @schema_replication=] 'schema_replication'
    Specifies that a schema change will be propagated when the Merge Agent runs.schema_replication is nvarchar(5), with a default of FALSE.

    Not

    Sadece yanlış desteklenip schema_replication.

  • [ @force_invalidate_snapshot = ] force_invalidate_snapshot
    Enables or disables the ability to have a snapshot invalidated.force_invalidate_snapshot is a bit, with a default of 0.

    0 birleştirme makale değişiklikleri anlık görüntü geçersiz olarak neden olmaz belirtir.

    1 belirtir geçersiz olarak anlık görüntüsünü birleştirme makale değişiklikler neden olabilir ve o durum, değeri 1 yeni anlık görüntü ortaya izni verir.

  • [ **@force_reinit_subscription = ]**force_reinit_subscription
    Enables or disables the ability to have the subscription reinitializated.force_reinit_subscription is a bit with a default of 0.

    0 birleştirme makale değişiklikleri abonelik yeniden neden olmaz belirtir.

    1 birleştirme makale değişiklikleri abonelik yeniden neden olabileceğini belirtir ve değeri, durum olup olmadığını 1 gerçekleşmesi abonelik reinitialization izni verir.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (başarısız)

Açıklamalar

sp_mergearticlecolumn birleştirmede kullanılan çoğaltma.

Bir kimlik sütunu otomatik kimlik aralık yönetimi kullanılıyorsa, makaleden bırakılan olamaz.Daha fazla bilgi için bkz: Kimlik sütunları çoğaltılıyor.

Bir uygulama yeni dikey bölüm sonra ayarlar, ilk anlık görüntü ise, oluşturulan yeni bir anlık görüntü oluşturulan ve gerekir her abonelik için yeniden.Anlık görüntü ve dağıtım veya Birleştirme Aracısı Çalıştır zamanlanan bir sonraki anlık uygulanır.

Satır izleme çakışma algılama (varsayılan) için kullanılan, en fazla 1024 sütun temel tablo içerebilir, ancak sütun filtre, dan makale en fazla 246 sütun yayımlanmış olduğunu.İzleme sütun kullanılıyorsa, en fazla 246 sütun temel tablo içerebilir.Daha fazla bilgi için bkz: "izleme düzeyi" kısmında Birleştirme çoğaltması nasıl algıladığı ve çakışmaları giderir.

Örnek

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

İzinler

Yalnızca üyeleri sysadmin sabit sunucu rolü veya db_owner sabit veritabanı rolü olabilir yürütmek sp_mergearticlecolumn.