Sql-server – How to specify a port number in SQL Server connection string

sql server

I use the following connection string in SQL Server Management Studio. It failed to connect:

mycomputer.test.xxx.com:1234\myInstance1

But the following one is ok:

mycomputer.test.xxx.com\myInstance1

So how do I specify a port number in a connection string?

Best Answer

Use a comma to specify a port number with SQL Server:

mycomputer.test.xxx.com,1234

It's not necessary to specify an instance name when specifying the port.

Lots more examples at http://www.connectionstrings.com/. It's saved me a few times.