Partager via


Propriété Server.InstanceName

Gets the instance name of the instance of SQL Server.

Espace de noms :  Microsoft.SqlServer.Management.Smo
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Syntaxe

'Déclaration
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Standalone Or SfcPropertyFlags.SqlAzureDatabase)> _
Public ReadOnly Property InstanceName As String 
    Get
'Utilisation
Dim instance As Server 
Dim value As String 

value = instance.InstanceName
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase)]
public string InstanceName { get; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Standalone|SfcPropertyFlags::SqlAzureDatabase)]
public:
property String^ InstanceName {
    String^ get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase)>]
member InstanceName : string
function get InstanceName () : String

Valeur de propriété

Type : System.String
A String value that specifies the instance name of the instance of SQL Server.

Notes

The InstanceName property specifies the name of the instance of SQL Server. This is usually the computer name but it may be a named instance that was specified during setup. InstanceName will return an empty string for the default instance.

Exemples

C#

Console.WriteLine(srv.InstanceName)

PowerShell

Write-Host $srv.InstanceName

Voir aussi

Référence

Server Classe

Espace de noms Microsoft.SqlServer.Management.Smo

Autres ressources

Définition de propriétés

Gestion des serveurs