Home » CodeProject » Why SQL Server Named Instance connect without specifying instance name ?

Why SQL Server Named Instance connect without specifying instance name ?

Issue :

Today Evening, I was just about to leave the office and at same time I got a call from one of my friend. He is not running under any production issue but bit confused with SQL server behavior while connecting with port no. in case of named instance.

He is having one named SQL Server 2005 instance running on non-default port 55537.

He tried to connect by following Server Names :-

· MachineName\InstanceName – Working fine & he is having no issue

· MachineName\InstanceName,PortNo – Working fine & he is having no issue

· MachineName,PortNo – Now this is the issue.

He is running with question :-

1. How SQL server is going to connect without instance name?

2. Is it connecting some different instance? But his machine is having only one named instance.

Solution :

The correct syntax for connecting to SQL Server is “Servername/InstanceName” or “ServerName,port”. When you specify both an instance name and the port, the connection is made to the port number.

So when you mention Port with machine name, SQL server connect to the SQL instance running on mentioned port without being knowing instance name.


3 Comments

  1. Keith Hays says:

    55537 is an ephemeral port and shouldn’t be used for SQL Server.

  2. Nice article, Just would like to add one more point that if SQL server is on local machine So you can connect it via dot (.) as well.

  3. Linda says:

    Check out the following article “How to Add a Hostname Alias for a SQL Server Instance”
    http://blogs.msdn.com/b/dbrowne/archive/2012/05/21/how-to-add-a-hostname-alias-for-a-sql-server-instance.aspx

Leave a Reply

Join us on Facebook

microsoftcommunitycontributor
%d bloggers like this: