TechNet
Export (0) Print
Expand All

Server::PingSqlServerVersion Method (String^)

 

Gets the version number of the instance of SQL Server.

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

public:
ServerVersion^ PingSqlServerVersion(
	String^ serverName
)

Parameters

serverName
Type: System::String^

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

Return Value

Type: Microsoft.SqlServer.Management.Common::ServerVersion^

A ServerVersion object value that specifies the version of the instance of SQL Server.

C#

Server srv = new Server("(local)");
Console.WriteLine(srv.PingSqlServerVersion("(local)"));

PowerShell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
Write-Host $srv.PingSqlServerVersion("(local)")
Return to top
Show:
© 2016 Microsoft