systemname | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

systemname

Hi all, Hoping u all r doing well. I’ve a system with name ‘ERD’. In that i installed the SQL server with the name ‘Server’. Now the question is, how to retrieve the system name(not the server name) using query. If I use @@servername i’ll get ‘Server’. But, I want ‘ERD’ . Any answers please…..
Rajendar
ok
You can run XP_CMDSHELL and use HOSTNAME to return the system name.
I think there are few registry keys to access this information, but for occasional use the above is better. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Dear satya, if I use Host_name(), i’ll get the client name. Suppose from client machine, i wanted to know the servers system name. How to get around this problem?? Rajendar
ok
Run XP_CMDSHELL and use HOSTNAME to return the system name.
HOSTNAME is the OS command to return the machine name and this runs at the server which returns the required value. HTH
Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
Dear Satya, I got it. Thank u very much
ok
too late probably, but you should also be able to use serverproperty( ‘machinename’ ) Cheers
Twan
]]>