November 18, 2005 at 2:16 am
Hi all,
Is it possible to get the name of the instance of SQL server that is running on a machine when it is not (local)?
ie. there is only one instance installed and it is named eg "NameOfMachine\SomeInstanceName".
Using "local" or "NameOfMachine" in the connection string does not find it.
Cheers,Chris.
November 25, 2005 at 4:25 pm
I don't have BOL to hand but I seem to remember that you can do something like SELECT @@SERVERNAME
November 25, 2005 at 6:44 pm
See SERVERPROPERTY in Books OnLine
select SERVERPROPERTY ('MachineName')
,SERVERPROPERTY ('InstanceName')
,SERVERPROPERTY ('ServerName')
Note that SERVERPROPERTY ('InstanceName') is NULL when this is the default instance.
SQL = Scarcely Qualifies as a Language
November 26, 2005 at 5:54 am
Do you know what Network Libraries the server is listening on? Is it a full-blown SQL Server or an MSDE install?
Also, you can tell the instance name by examining the registry (HKLM\System\CurrentControlSet\Services\MSSQL$<Instance Name> ). The same is true of the file system if default paths were set: C:\Program Files\Microsoft SQL Server\MSSQL$<Instance Name>.
K. Brian Kelley
@kbriankelley
November 26, 2005 at 11:35 am
If this is a one-time and manual process, open a command window and enter
isql -L
If this is on-going in a program, you can use SQL DMO:
Dim namX As NameList
Set namX = oSQLServerDMOApp.ListAvailableSQLServers
There is sample source for Visual Basic located at \devtools\samples\sqldmo\vb\Login
SQL = Scarcely Qualifies as a Language
December 5, 2005 at 12:36 am
Thanks for your suggestions.
The method we decided on implementing was calling the GetSQLServerInstanceNames method from the SQL DMO library.
Cheers,
Chris.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy