How to change the port when calling sqlcmd
According to this MSDN link, you'd use -S tcp:servername,32001
.
Following solution is working for me in SQL Server 2008 and above.
sqlcmd -S "hostname or IP,port number" -U SA -P password
That's it: How to Connect to the Database Engine using sqlcmd. Something like this:
sqlcmd -S ComputerA,1691