How to change port when sqlcmd is called

I have this team

sqlcmd.exe -E -i "C:\joe-db-scripts\joe-db-tasks.Install.sql" 

and I need to add a specific non-standard port 32001. How do I do this? I was thinking of some kind of flag like -p or something, but I don't know the syntax.

+8
sql sqlcmd
source share
3 answers

According to this MSDN link , you should use -S servername,32001 .

+18
source share

What it is: How to connect to the database engine using sqlcmd . Something like that:

 sqlcmd -S ComputerA,1691 
+3
source share

The following solution works for me in SQL Server 2008 and above.

sqlcmd -S "hostname or IP, port number" -U SA -P password

0
source share

All Articles