Find out Windows computer name on which the SQL Server instance is running

SQL Server Management Studio:

To find out Windows computer name on which the SQL Server instance is running, or the name of the virtual server for a clustered instance, run this SQL Server query:

SELECT SERVERPROPERTY('MachineName')
GO

To find out Windows server and instance information for a specified instance of SQL Server:

SELECT SERVERPROPERTY('ServerName')
GO

To find out NetBIOS name of the local computer on which the instance of SQL Server is currently running, or the name of the node in the failover cluster:

Select SERVERPROPERTY('ComputerNamePhysicalNetBIOS')
GO

To find out the server name of the computer during SQL Server installation:

SELECT @@SERVERNAME
GO

The ServerName property and @@SERVERNAME return the same information if the default server name at the time of installation has not been changed.
When the computer name is changed, use sp_addserver to inform the instance of the SQL Server of the new computer name:

sp_dropserver 'old_server_name'
GO
sp_addserver 'current_server_name', 'local'

…and then restart SQL Server for the changes to take effect.

Windows:

One way to find out the local computer name or the remote computer name you are connected to using Remote Desktop connection, is to open the System Properties window:
On Desktop right click on Computer icon and choose 'Properties':

right_click_computer_properties

or
Start -> Control Panel -> System

or
use keyboard shortcut key 'Windows key + BREAK'

It will open the System Properties Window in which you can find the Computer Name:

system_properties_computer_name

Another way to find out the local computer name or the remote computer name you are connected to using Remote Desktop connection, is from Command prompt:
Open Command prompt (Start -> Run -> cmd.exe)
Type hostname and hit Enter:

command_prompt_hostname

Read related article:
Fixing Error: “Sql Server replication requires the actual server name to make a connection to the server.”

If the post helped you, please share it:
Pin It

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">