SQL Server Performance

How do I get the PHYSICAL name of a server?

Discussion in 'General DBA Questions' started by jaybee, Aug 3, 2007.

  1. jaybee New Member

  2. satya Moderator

    EXEC master..XP_CMDSHELL 'Hostname'
  3. thomas New Member

    Or (2005 only),
    SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')
  4. jaybee New Member

    Hi again Satya, thanks, that worked !!!
  5. Adriaan New Member

    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?
  6. thomas New Member

    select hostname() returns the name of the client, not the server.
  7. Adriaan New Member

    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.
  8. satya Moderator

    I believe serverproperty is introduced iN SQL 2000/
  9. thomas New Member

    [quote user="satya"]
    I believe serverproperty is introduced iN SQL 2000/
    Yeah it was, but it changed quite significantly from 2000 to 2005 (e.g the ComputerNetBiosName value).
  10. satya Moderator

    yes as compared to SQL 2000, in 2005 it uses blend of power shell.
  11. gk_sql New Member

    I used to use the following command which tells in which node the instance is currently running.
    Exec master..xp_cmdshell 'net user'
  12. satya Moderator

    You mean within the cluster, that means it takes the workstation.
    SERVERPROPERTY('ComputerNamePhysicalNetBIOS') is best to go in this case.
  13. dineshasanka Moderator

    SERVERPROPERTY('MachineName') as [Cluster Virtual Server Name],
    SERVERPROPERTY('ComputerNamePhysicalNetBIOS') as [Cluster Node Name]

Share This Page