Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2008-06-18 : 04:12:16
|
| Hi,Question:How do I get the hostname from the instance name please?My present design at present is something as follows:We have several sql server 2005 machines i.e. ServerSQLA, ServerSQLB, etc.... Each machine may have one or more instances, i.e. ServerSQLA\instace1ServerSQLA\instace2, etc...The server name in this case is ServerSQLAInstance naming and node convention is different for clustersi.e.C_ServerSQLA\instance1C_ServerSQLA\instance2on the node(s):N_ServerSQLA or N_ServerSQLBThanks |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-18 : 04:13:23
|
Have you tried @@SERVERNAME ? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2008-06-18 : 04:17:52
|
| No, But will this give the correct hostname based on the instance?Thanks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-18 : 04:25:33
|
You have to try on your cluster. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-06-18 : 04:27:06
|
Or try the SERVERPROPERTY function?SELECT SERVERPROPERTY('InstanceName'), SERVERPROPERTY('MachineName'), SERVERPROPERTY('ServerName') E 12°55'05.25"N 56°04'39.16" |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2008-06-18 : 05:07:35
|
| I will try this soon and come back to you.Thanks |
 |
|
|
arkiboys
Master Smack Fu Yak Hacker
1433 Posts |
Posted - 2008-06-18 : 06:21:43
|
| None of these appear to give the actual windows hostname of the active node for a clustered instance.Not sure if this query is useful:SELECT * FROM fn_virtualservernodes()Thanks |
 |
|
|
|
|
|