Server.InstanceName 属性

Gets the instance name of the instance of SQL Server.

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Standalone Or SfcPropertyFlags.SqlAzureDatabase)> _
Public ReadOnly Property InstanceName As String 
    Get
用法
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

属性值

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

注释

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.

示例

C#

Console.WriteLine(srv.InstanceName)

PowerShell

Write-Host $srv.InstanceName

请参阅

参考

Server 类

Microsoft.SqlServer.Management.Smo 命名空间

其他资源

设置属性

管理服务器