Свойство 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
Объект SystemMessageCollection, представляющий все системные сообщения, определенные на экземпляре SQL Server.
Замечания
The SystemMessages property points to the SystemMessageCollection object, which references the system messages on the instance of SQL Server. You can use the collection to reference the predefined system messages. Use the UserDefinedMessages property to access user-defined messages.
Примеры
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
См. также