Article.PublicationName プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
記事が所属する出版物の名前を取得するか設定します。
public:
property System::String ^ PublicationName { System::String ^ get(); void set(System::String ^ value); };
public string PublicationName { get; set; }
member this.PublicationName : string with get, set
Public Property PublicationName As String
プロパティ値
出版物の名前。
例外
既存の記事の PublicationName プロパティを設定しようとするとき。
PublicationNameプロパティをnull値、null文字の値、または128-Unicode文字より長い値に設定すると、
例
// 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
注釈
PublicationNameプロパティは読み書きプロパティなので、オブジェクトを作成する前に設定する必要があります。
PublicationNameプロパティは、Createメソッドを呼び出してサーバー上で記事を作成する前に設定しなければなりません。 既存の記事に対してこのプロパティを設定しようとすると例外が発生します。
PublicationNameプロパティは、sysadmin固定サーバーの役割のメンバーが、Publisherおよびサブスクライバー(サブスクライバーの再公開用)で取得できます。 また、出版データベースの db_owner 固定データベース役割のメンバーやPALのメンバーからも取得可能です。
MergeArticleオブジェクトの場合、このプロパティはディストリビュータ上のreplmonitor固定データベースロールのメンバーによっても取得可能です。
PublicationNameプロパティはPublisherのsysadmin固定サーバーロールのメンバーによって設定可能です。 また、出版データベース上の db_owner 固定データベースの役割のメンバーによって設定することもできます。
PublicationNameの取得は、トランザクションレプリケーションやスナップショットレプリケーションのためのsp_helparticle(Transact-SQL)の実行、マージレプリケーションのための実行sp_helpmergearticle(Transact-SQL)と同等です。
設定 PublicationName は、トランザクションレプリケーションやスナップショットレプリケーションで実行 sp_addarticle(Transact-SQL )を実行すること、マージレプリケーションで実行中の sp_addmergearticle(Transact-SQL )を実行するのと同等です。