Freigeben über


How to: View and Modify Article Properties (Replication Transact-SQL Programming)

Articles can be modified and their properties returned programmatically using replication stored procedures. The stored procedures that you use depend on the type of publication to which the article belongs.

To view the properties of an article belonging to a snapshot or transactional publication

  1. Execute sp_helparticle, specifying the name of the publication for the @publication parameter and the name of the article for the @article parameter. If you do not specify @article, information will be returned for all articles in the publication.

  2. Execute sp_helparticlecolumns for table articles to list all columns available in the base table.

To modify the properties of an article belonging to a snapshot or transactional publication

  1. Execute sp_changearticle, specifying the article property being changed in the @property parameter and the new value of this property in the @value parameter.

    ms147928.note(de-de,SQL.90).gifHinweis:
    If the change requires the generation of a new snapshot, you must also specify a value of 1 for @force_invalidate_snapshot, and if the change requires that Subscribers be reinitialized, you must also specify a value of 1 for @force_reinit_subscription. For more information on the properties that, when changed, require a new snapshot or reinitialization, see Ändern von Publikations- und Artikeleigenschaften.

To view the properties of an article belonging to a merge publication

  1. Execute sp_helpmergearticle, specifying the name of the publication for the @publication parameter and the name of the article for the @article parameter. If you do not specify these parameters, information will be returned for all articles in a publication or at the publisher.

  2. Execute sp_helpmergearticlecolumn for table articles to list all columns available in the base table.

To modify the properties of an article belonging to a merge publication

  1. Execute sp_changemergearticle, specifying the article property being changed in the @property parameter and the new value of this property in the @value parameter.

    ms147928.note(de-de,SQL.90).gifHinweis:
    If the change requires the generation of a new snapshot, you must also specify a value of 1 for @force_invalidate_snapshot, and if the change requires that Subscribers be reinitialized, you must also specify a value of 1 for @force_reinit_subscription. For more information on the properties that, when changed, require a new snapshot or reinitialization, see Ändern von Publikations- und Artikeleigenschaften.

Beispiel

This transactional replication example returns the properties of the published article.

DECLARE @publication AS sysname;
SET @publication = N'AdvWorksProductTran';

USE [AdventureWorks]
EXEC sp_helparticle
  @publication = @publication;
GO

This transactional replication example changes the schema options for the published article.

DECLARE @publication AS sysname;
DECLARE @article AS sysname;
DECLARE @option AS int;
SET @publication = N'AdvWorksProductTran';
SET @article = N'Product';
SET @option = (SELECT CAST(0x0000000002030073 AS int));

-- Change the schema options to replicate schema with XML.
USE [AdventureWorks]
EXEC sp_changearticle 
  @publication = @publication,
  @article = @article, 
  @property = N'schema_option', 
  @value = @option,
  @force_invalidate_snapshot = 1;
GO

This merge replication example returns the properties of the published article.

DECLARE @publication AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorks]
EXEC sp_helpmergearticle
  @publication = @publication;
GO

This merge replication example changes the conflict detection settings for a published article.

DECLARE @publication AS sysname;
DECLARE @article AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @article = N'SalesOrderHeader';

-- Enable column-level conflict tracking.
-- Changing this property requires that existing subscriptions
-- be reinitialized and that a new snapshot be generated.
USE [AdventureWorks]
EXEC sp_changemergearticle 
  @publication = @publication,
  @article = @article, 
  @property = N'column_tracking', 
  @value = N'true',
  @force_invalidate_snapshot = 1,
  @force_reinit_subscription = 1;
GO

Siehe auch

Aufgaben

How to: View and Modify Article Properties (RMO Programming)

Konzepte

Programming Replication Using System Stored Procedures

Andere Ressourcen

Ändern von Publikations- und Artikeleigenschaften
Erweiterte Konflikterkennung und -lösung bei der Mergereplikation

Hilfe und Informationen

Informationsquellen für SQL Server 2005