Mike,
the registry keys and values you mentioned, that's exactly what I was =
looking for.=20
Thanks a lot
Melanie
[quoted text, click to view] "Mike Hodgson" <e1minst3r@gmail.com> wrote in message =
news:%23gPKz2zNGHA.532@TK2MSFTNGP15.phx.gbl...
Ah, you want to enumerate SQL instances in order to connect to one? =
To me that screams SMO (SQL Management Objects) but it's been some time =
since I played with SQL-DMO (SMO's previous incarnation) so I can't =
offer any authoritative comments.
However, I'd be looking at the ManagedComputer class in the =
Microsoft.SqlServer.Management.Smo.Wmi namespace (in .NET 2.0). I think =
given a ManagedComputer object, you can get a collection of the SQL =
instances on that computer with the ServerInstances property. But I =
don't really know how you'd then get a connection string for one of =
those particular instances to actually connect to. Maybe someone in the =
programming newsgroup can help.
If you want to just poke through the registry (I wouldn't recommend =
it) I'd guess the virtual server name is stored in the ClusterName reg =
string value of the HKLM\SOFTWARE\Microsoft\Microsoft SQL =
Server\MSSQL.1\Cluster\ key. I think the instance names would then be =
stored under the HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance =
Names\SQL\ key (or you could get them from =
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\InstalledInstances (and =
multi-valued string)). The steps would probably be 1) look up the =
instances in the InstalledInstances value, 2) for the instance you're =
after get the reg branch from the HKLM\...\Instance =
Names\SQL\<InstanceName>, 3) from the reg branch specified in that value =
get the virtual server name from the =
HKLM\...\<InstanceBranch>\Cluster\ClusterName value. Something like =
that (that's really just a guess).
--
mike hodgson
http://sqlnerd.blogspot.com=20
CShane wrote:=20
Not sure exactly what the situation is, but could cluster.exe help? It =
can=20
list groups and resources. What information IS known? Do you know the =
node=20
name and are just looking for a virtual server name? Do you want to =
list ALL=20
sql servers in the domain? In short, what do you know and what are you=20
looking for?
Shane
[quoted text, click to view] "melanie" wrote:
This works if I already have a connection to the sql server. But my =
problem is I have to find the name of the server I can connect to.
Any other solution?
Thanks
Melanie
[quoted text, click to view] "Mike Hodgson" <e1minst3r@gmail.com> wrote in message =
news:%23iRtotmNGHA.2320@TK2MSFTNGP11.phx.gbl...
The correct way to do this in SQL 2005 is the same as the correct way =
to do it in SQL 2000. That is,
SELECT SERVERPROPERTY('MachineName')
No need to go messing about in the registry, simply ask SQL Server and =
it will tell you. Check out the SERVERPROPERTY() function in BOL - it's =
packed full of useful goodies (so to is OBJECTPROPERTY(), =
INDEXPROPERTY() and the INFORMATION_SCHEMA schema).
--
mike hodgson
http://sqlnerd.blogspot.com=20
melanie wrote:=20
Hello,
Does anybody know how I can programmatically detect the name of the =
virtual=20
server if sql 2005 is running on a cluster?
In previous sql versions I looked up the following registry entries:
Default instance: "HKLM\\SOFTWARE\\Microsoft\\MSSQLServer\\Cluster" =
REG_SZ=20
"ClusterName"
Named instance: "HKLM\\SOFTWARE\\Microsoft\\Microsoft SQL=20
Server\\<InstanceName>\\Cluster" REG_SZ "ClusterName"
It seems as if this changed for sql 2005, right?
Thanks a lot
Melanie=20