次の方法で共有


SubscriptionField Constructor (SubscriptionClass, String)

SubscriptionClass オブジェクトおよび名前を使用して、SubscriptionField クラスの新しいインスタンスを初期化します。

名前空間: Microsoft.SqlServer.Management.Nmo
アセンブリ: Microsoft.SqlServer.Smo (microsoft.sqlserver.smo.dll 内)

構文

'宣言
Public Sub New ( _
    subscriptionClass As SubscriptionClass, _
    name As String _
)
public SubscriptionField (
    SubscriptionClass subscriptionClass,
    string name
)
public:
SubscriptionField (
    SubscriptionClass^ subscriptionClass, 
    String^ name
)
public SubscriptionField (
    SubscriptionClass subscriptionClass, 
    String name
)
public function SubscriptionField (
    subscriptionClass : SubscriptionClass, 
    name : String
)

パラメータ

  • subscriptionClass
    サブスクリプション フィールドの親である SubscriptionClass オブジェクトです。
  • name
    サブスクリプション フィールドの名前を示す長さ 1 ~ 128 文字の String です。

    名前は変更できません。サブスクリプション フィールドの名前を変更するには、フィールドを削除してから、新しい名前を持つ新しいサブスクリプション フィールドを追加します。

解説

Type プロパティを設定する必要があります。TypeModifier プロパティの設定は省略可能です。

フィールド名は、英字またはアンダースコアで始まる必要があり、英字、数字の他に、_#@ および $ を含めることができます。また、Microsoft SQL Server の識別子規則に準拠する必要があります。SQL Server の識別子の詳細については、「識別子」を参照してください。

ms192110.note(ja-jp,SQL.90).gif重要 :
サブスクリプション フィールドの名前として、CreatedEnabledSubscriberIdSubscriptionId、または Updated を使用することはできません。これらのフィールド名は Microsoft SQL Server 2005 Notification Services で既に内部使用されています。

フィールド名を更新した後、アプリケーションを更新すると、対応するサブスクリプション クラスが再作成されます。Notification Services は、既存のサブスクリプション テーブルの名前に "Old" を追加して名前を変更してから、新しいテーブルを作成します。以前のサブスクリプション テーブルのインデックスは、変更されずに残されます。

以前のサブスクリプション テーブルから新しいサブスクリプション テーブルにデータを転送するには、手動で転送する必要があります。詳細については、「アプリケーションの更新」を参照してください。

使用例

次の例は、サブスクリプション フィールドを定義してサブスクリプション スキーマに追加する方法を示しています。

// Define a SubscriberLocale field that cannot be NULL
// Add the field to the end of the field collection
SubscriptionField subLocale = 
    new SubscriptionField(flightSubscriptions, "SubscriberLocale");
subLocale.Type = "nvarchar(10)";
subLocale.TypeModifier = "not null";
flightSubscriptions.SubscriptionFields.Add(subLocale);
' Define a SubscriberLocale field that cannot be NULL
' Add the field to the end of the field collection
Dim subLocale As SubscriptionField = _
    New SubscriptionField(flightSubscriptions, _
    "SubscriberLocale")
subLocale.Type = "nvarchar(10)"
subLocale.TypeModifier = "not null"
flightSubscriptions.SubscriptionFields.Add(subLocale)

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

SubscriptionField Class
SubscriptionField Members
Microsoft.SqlServer.Management.Nmo Namespace

その他の技術情報

サブスクリプション スキーマの定義
SubscriptionClass/Schema/Field の FieldName 要素 (ADF)