Blog Post

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.