Freigeben über


Using SQL instance name when using a static port

Did you know that if you have a named instance of SQL, and that SQL instance is setup to use a static port (e.g. 2375 for something random), that you do not need to use the instance name when connecting to the SQL instance?

For example, if I setup a server, called Server1, and I setup a named instance of SQL, let's call it SQL1, normally I would connect to this as "Server1\SQL1"  However, if I configure SQL1 to use our TCP port 2375, I can just specify "Server1,2375" for the connection.  Doing a "servername\instance,port" is unnecessary as the instance name is completely ignored when using the port number.  "Server1\BobsFishAndChips,2375" has the same net effect as "Server1\SQL1,2375" or just "Server1,2375"

It makes perfect sense because two SQL instances cannot exist on the same IP/port combination.  So why bring it up?  Because I've found two cases now where using the instance name and port actually doesn't work.  The first case is Notification Services - when configuring a SQL server as a parameter, the UI will actually blow up on the "\" character.

The second case is for executing WMI calls using the ManagementObjectSearcher object and you specify a BizTalk server database name, the call actually returns no results with the instance name included.

From here on out I'll be keeping it simple and using the port ONLY!