title: What happens when port number is not specified in SQL Server connection string?
body: <p>I have two instances of SQL Server on my local machine.  They both listen to separate ports.  The first instance that I installed runs on the default port: 1433.  I have set the other to listen to port 1434.</p>
  
  <p>My application is using some old shared code that we have here to generate the connection string.  So until now I didn't really know what was happening there.  Due to a new requirement I found myself needing to examine the connection strings that I'm using to connect to the SQL Server.</p>
  
  <p>What I found that was that for the connection string be built to connect to each of the SQL instances did not include Network Library, nor did they include the port number as part of the Data Source.  The Data Source was just set to <code>&lt;Server Name&gt;/&lt;Instance Name&gt;</code>. I did find in the MS documentation that if the Network Library is not included then it is treated as <code>(local)</code>, but it doesn't really explain how <code>(local)</code> is treated.</p>
  
  <p>So my question is why is a connection string in this format able to connect to the SQL Server instance that runs on the non-default port? will this only work if the instances are on the local machine, or local network? Can I put <code>&lt;ip&gt;/&lt;sql instance&gt;</code> without the port if the server is remote?</p>
  
  <p>I just need some clarity on how this works, and when is the port number needed and when it is optional as I'm trying to make my connection UI as simple as possible for our users.</p>