Server.SystemMessages Property

 

Applies To: SQL Server 2016 Preview

Represents a collection of SystemMessage objects. Each SystemMessage object represents a system message defined on the instance of SQL Server.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, 
    SfcContainerCardinality.ZeroToAny, typeof(SystemMessage))]
public SystemMessageCollection SystemMessages { get; }
public:
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, 
    SfcContainerCardinality::ZeroToAny, (SystemMessage^::typeid))]
property SystemMessageCollection^ SystemMessages {
    SystemMessageCollection^ get();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer,
    SfcContainerCardinality.ZeroToAny, typeof(SystemMessage))>]
member SystemMessages : SystemMessageCollection with get
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer,
    SfcContainerCardinality.ZeroToAny, GetType(SystemMessage))>
Public ReadOnly Property SystemMessages As SystemMessageCollection

Property Value

Type: Microsoft.SqlServer.Management.Smo.SystemMessageCollection

A SystemMessageCollection object that represents all the system messages defined on the instance of SQL Server.

Remarks

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.

Examples

Legacy Code Example

Visual Basic

Code snippet is not found. Confirm that the code snippet name 'SMO How to' is correct.

PowerShell

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

See Also

Server Class
Microsoft.SqlServer.Management.Smo Namespace
Using Collections
Setting Properties

Unable to find linked topic '776ac273-bbe5-45e2-8bc8-a6f2b9cac03a'.

Return to top