title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | helpviewer_keywords | dev_langs | monikerRange | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
View and Modify Article Properties |
View and Modify Article Properties |
MashaMSFT |
mathoma |
09/25/2024 |
sql |
replication |
how-to |
|
|
|
=azuresqldb-mi-current||>=sql-server-2016 |
[!INCLUDEsql-asdbmi] This topic describes how to view and modify article properties in [!INCLUDEssnoversion] by using [!INCLUDEssManStudioFull], [!INCLUDEtsql], or Replication Management Objects (RMO).
In This Topic
-
Before you begin:
-
To view and modify article properties, using:
- Some properties cannot be modified after a publication has been created, and others cannot be modified if there are subscriptions to the publication. Properties that cannot be modified are displayed as read-only.
- After a publication is created, some property changes require a new snapshot. If a publication has subscriptions, some changes also require all subscriptions to be reinitialized. For more information, see Change Publication and Article Properties and Add Articles to and Drop Articles from Existing Publications.
View and modify article properties in the Publication Properties - <Publication> dialog box, which is available in [!INCLUDEmsCoName] [!INCLUDEssManStudioFull] and Replication Monitor. For information about starting Replication Monitor, see Start the Replication Monitor.
-
The General page includes the publication name and description, the database name, the type of publication, and the subscription expiration settings.
-
The Articles page corresponds to the Articles page in the New Publication Wizard. Use this page to add and delete articles, and to change properties and column filtering for articles.
-
The Filter Rows page corresponds to the Filter Table Rows page in the New Publication Wizard. Use this page to add, edit, and delete static row filters for all types of publications, and to add, edit, and delete parameterized row filters and join filters for merge publications.
-
The Snapshot page allows you to specify the format and location of the snapshot, whether the snapshot should be compressed, and scripts to run before and after the snapshot is applied.
-
The FTP Snapshot page (for snapshot and transactional publications, and merge publications for Publishers running versions prior to SQL Server 2005) allows you to specify whether Subscribers can download snapshot files through File Transfer Protocol (FTP).
-
The FTP Snapshot and Internet page (for merge publications from Publishers running SQL Server 2005 or later) allows you to specify whether Subscribers can download snapshot files through FTP, and whether Subscribers can synchronize subscriptions through HTTPS.
-
The Subscription Options page allows you to set a number of options that apply to all subscriptions. The options differ depending on the type of publication.
-
The Publication Access List page allows you to specify which logins and groups can access a publication.
-
The Agent Security page allows you to access settings for the accounts under which the following agents run and make connections to the computers in a replication topology: the Snapshot Agent for all publications; the Log Reader Agent for all transactional publications; and the Queue Reader Agent for transactional publications that allow queued updating subscriptions.
-
The Data Partitions page (for merge publications from Publishers running SQL Server 2005 or later) allows you to specify whether Subscribers to publications with parameterized filters can request a snapshot if one is not available. It also allows you to generate snapshots for one or more partitions, either once or on a recurring schedule.
-
On the Articles Page of the Publication Properties - <Publication> dialog box, select an article, and then click Article Properties.
-
Select which articles property changes should apply to:
-
Click Set Properties of Highlighted <ObjectType> Article to launch the Article Properties - <ObjectName> dialog box; property changes made in this dialog box are applied only to the object that is highlighted in the object pane on the Articles page.
-
Click Set Properties of All <ObjectType> Articles, to launch the Properties for All <ObjectType> Articles dialog box; property changes made in this dialog box are applied to all objects of that type in the object pane on the Articles page, including ones not yet selected for publication.
[!NOTE]
Property changes made in the Properties for All <ObjectType> Articles dialog box override any made previously in the Article Properties - <ObjectName> dialog box. If, for example, you want to set a number of defaults for all articles of an object type, but also want to set some properties for individual objects, set the defaults for all articles first. Then set the properties for the individual objects.
-
-
Modify any properties if necessary, and then click OK.
-
Click OK on the Publication Properties - <Publication> dialog box.
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.
-
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. -
Execute sp_helparticlecolumns for table articles to list all columns available in the base table.
-
Execute sp_changearticle, specifying the article property being changed in the
@property
parameter and the new value of this property in the@value
parameter.[!NOTE]
If the change requires the generation of a new snapshot, you must also specify a value of1
for@force_invalidate_snapshot
, and if the change requires that Subscribers be reinitialized, you must also specify a value of1
for@force_reinit_subscription
. For more information on the properties that, when changed, require a new snapshot or reinitialization, see Change Publication and Article Properties.
-
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. -
Execute sp_helpmergearticlecolumn for table articles to list all columns available in the base table.
-
Execute sp_changemergearticle, specifying the article property being changed in the
@property
parameter and the new value of this property in the@value
parameter.[!NOTE]
If the change requires the generation of a new snapshot, you must also specify a value of1
for@force_invalidate_snapshot
, and if the change requires that Subscribers be reinitialized, you must also specify a value of1
for@force_reinit_subscription
. For more information on the properties that, when changed, require a new snapshot or reinitialization, see Change Publication and Article Properties.
This transactional replication example returns the properties of the published article.
:::code language="sql" source="../codesnippet/tsql/view-and-modify-article-_1.sql":::
This transactional replication example changes the schema options for the published article.
:::code language="sql" source="../codesnippet/tsql/view-and-modify-article-_2.sql":::
This merge replication example returns the properties of the published article.
:::code language="sql" source="../codesnippet/tsql/view-and-modify-article-_3.sql":::
This merge replication example changes the conflict detection settings for a published article.
:::code language="sql" source="../codesnippet/tsql/view-and-modify-article-_4.sql":::
You can modify articles and access their properties programmatically by using Replication Management Objects (RMO). The RMO classes you use to view or modify article properties depend on the type of publication to which the article belongs.
-
Create a connection to the Publisher by using the xref:Microsoft.SqlServer.Management.Common.ServerConnection class.
-
Create an instance of the xref:Microsoft.SqlServer.Replication.TransArticle class.
-
Set the xref:Microsoft.SqlServer.Replication.Article.Name%2A, xref:Microsoft.SqlServer.Replication.Article.PublicationName%2A, and xref:Microsoft.SqlServer.Replication.Article.DatabaseName%2A properties.
-
Set the connection from step 1 for the xref:Microsoft.SqlServer.Replication.ReplicationObject.ConnectionContext%2A property.
-
Call the xref:Microsoft.SqlServer.Replication.ReplicationObject.LoadProperties%2A method to get the properties of the object. If this method returns false, either the article properties in step 3 were defined incorrectly or the article does not exist.
-
(Optional) To change properties, set a new value for one of the xref:Microsoft.SqlServer.Replication.TransArticle properties that can be set.
-
(Optional) If you specified a value of true for xref:Microsoft.SqlServer.Replication.ReplicationObject.CachePropertyChanges%2A, call the xref:Microsoft.SqlServer.Replication.ReplicationObject.CommitPropertyChanges%2A method to commit changes on the server. If you specified a value of false for xref:Microsoft.SqlServer.Replication.ReplicationObject.CachePropertyChanges%2A (the default), changes are sent to the server immediately.
-
Create a connection to the Publisher by using the xref:Microsoft.SqlServer.Management.Common.ServerConnection class.
-
Create an instance of the xref:Microsoft.SqlServer.Replication.MergeArticle class.
-
Set the xref:Microsoft.SqlServer.Replication.Article.Name%2A, xref:Microsoft.SqlServer.Replication.Article.PublicationName%2A, and xref:Microsoft.SqlServer.Replication.Article.DatabaseName%2A properties.
-
Set the connection from step 1 for the xref:Microsoft.SqlServer.Replication.ReplicationObject.ConnectionContext%2A property.
-
Call the xref:Microsoft.SqlServer.Replication.ReplicationObject.LoadProperties%2A method to get the properties of the object. If this method returns false, either the article properties in step 3 were defined incorrectly or the article does not exist.
-
(Optional) To change properties, set a new value for one of the xref:Microsoft.SqlServer.Replication.MergeArticle properties that can be set.
-
(Optional) If you specified a value of true for xref:Microsoft.SqlServer.Replication.ReplicationObject.CachePropertyChanges%2A, call the xref:Microsoft.SqlServer.Replication.ReplicationObject.CommitPropertyChanges%2A method to commit changes on the server. If you specified a value of false for xref:Microsoft.SqlServer.Replication.ReplicationObject.CachePropertyChanges%2A (the default), changes are sent to the server immediately.
This example changes a merge article to specify the business logic handler used by the article.
[!code-csHowTo#rmo_ChangeMergeArticle_BLH]
[!code-vbHowTo#rmo_vb_ChangeMergeArticle_BLH]