How does SSMS grab the name of my server?
-4
votes
2
answers
284
views
In the bottom-right hand side of SSMS's main screen and to the left of where it shows my user-name and the name of the database that I'm in, it gives the name of the server that I'm on. This string is the same as what I put in the "Server name" field when connecting to the server when I first open SSMS and is also shown in the Object Explorer. How does SSMS determine this name? I've tried
SELECT
HOST_NAME(),
@@SERVICENAME,
DB_NAME,
@@SERVERNAME,
SERVERPROPERTY('InstanceName'),
SERVERPROPERTY('MachineName')
but only SERVERPROPERTY('MachineName')
returns a substring of what SSMS shows. The rest have nothing at all to do with the string in question.
Asked by J. Mini
(1235 rep)
Jan 20, 2024, 04:20 PM
Last activity: Feb 13, 2024, 11:55 PM
Last activity: Feb 13, 2024, 11:55 PM