次の方法で共有


SystemMessages プロパティ

SystemMessage オブジェクトのコレクションを表します。各 SystemMessage オブジェクトは、SQL Server のインスタンスで定義されたシステム メッセージを表します。

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(SystemMessage))> _
Public ReadOnly Property SystemMessages As SystemMessageCollection
    Get
'使用
Dim instance As Server
Dim value As SystemMessageCollection

value = instance.SystemMessages
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(SystemMessage))]
public SystemMessageCollection SystemMessages { get; }
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, SfcContainerCardinality::ZeroToAny, 
    typeof(SystemMessage))]
public:
property SystemMessageCollection^ SystemMessages {
    SystemMessageCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(SystemMessage))>]
member SystemMessages : SystemMessageCollection
function get SystemMessages () : SystemMessageCollection

プロパティ値

型: Microsoft.SqlServer.Management.Smo. . :: . .SystemMessageCollection
SQL Server のインスタンスで定義されたすべてのシステム メッセージを表す SystemMessageCollection オブジェクトです。

説明

SystemMessages プロパティは SystemMessageCollection オブジェクトを参照しています。このオブジェクトは、SQL Server のインスタンスのシステム メッセージを参照します。このコレクションを使用して、定義済みのシステム メッセージを参照できます。ユーザー定義メッセージにアクセスするには、UserDefinedMessages プロパティを使用します。

使用例

Visual Basic

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Reference an existing system message using the ItemByIdAndLanguage method.
Dim msg As SystemMessage
msg = srv.SystemMessages.ItemByIdAndLanguage(14126, "us_english")
'Display the message ID and  text.
Console.WriteLine(msg.ID.ToString + " " + msg.Text)

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$msg = $srv.SystemMessages.ItemByIdAndLanguage(14126, "us_english")
Write-Host $msg.ID, $msg.Text