The PingSQLServerVersion method returns a long integer describing a Microsoft® SQL Server™ installation version.
object.PingSQLServerVersion( [ ServerName ] , [ Login ] , [ Password ] )
as SQLDMO_SQL_VER
Part | Description |
---|---|
object | Expression that evaluates to an object in the Applies To list. |
ServerName | Optional. A string identifying and existing SQL Server installation by installed name. |
Login | Optional. A string identifying and existing SQL Server login by name. |
Password | Optional. A string supplying a password and used for authentication of the Login argument in method execution. |
Evaluate the return value of the PingSQLServerVersion method by using these values.
Constant | Value | Description |
---|---|---|
SQLDMOSQLVer_60 | 2 | Server installation queried is SQL Server version 6.0 |
SQLDMOSQLVer_65 | 4 | Server installation queried is version 6.5 |
SQLDMOSQLVer_70 | 8 | Server installation queried is version 7.0 |
SQLDMOSQLVer_Pre_60 | 1 | Server installation queried is a version released prior to version 6.0 |
SQLDMOSQLVer_Unknown | 0 | Unable to determine SQL Server installation version |
The SQL-DMO object library released with SQL Server 7.0 cannot connect to or be used to administer a SQL Server installation with a version less than 7.0. To administer SQL Server 7.0 installations and installations of earlier versions, an application can reference the SQL-DMO object library released with SQL Server 7.0 and the library released with an earlier version.
The PingSQLServerVersion method:
The method cannot be used on a connected SQLServer object.
When the ServerName argument is not specified, the PingSQLServerVersion method attempts to connect to a SQL Server installation using the network name of the computer on which the application is running.
When used, the Login and Password arguments indicate use of SQL Server Authentication for connection validation. When no value is supplied in the Login argument, Windows NT Authentication is used for connection validation and any value aupplied in the Password arguement is ignored.
HRESULT PingSQLServerVersion(SQLDMO_SQL_VER *pRetVal,
SQLDMO_LPCSTR szServerName, SQLDMO_LPCSTR szLogin,
SQLDMO_LPCSTR szPassword);