This is probably an ANSI standard function: select host_name() Since you're asking about the physical name, I have to wonder which one you would like to see returned for a SQL Server instance running under VM Ware or the likes?
Thanks Thomas - should have thought of that myself. In addition to what Satya said - SERVERPROPERTY('MachineName') works in SQL 2000, but not in SQL 7.0.
[quote user="satya"] I believe serverproperty is introduced iN SQL 2000/ [/quote] Yeah it was, but it changed quite significantly from 2000 to 2005 (e.g the ComputerNetBiosName value).
Hi, I used to use the following command which tells in which node the instance is currently running. Exec master..xp_cmdshell 'net user' gk
You mean within the cluster, that means it takes the workstation. SERVERPROPERTY('ComputerNamePhysicalNetBIOS') is best to go in this case.
select SERVERPROPERTY('MachineName') as [Cluster Virtual Server Name], SERVERPROPERTY('ComputerNamePhysicalNetBIOS') as [Cluster Node Name]