How to change the port when calling sqlcmd

百般思念 提交于 2019-12-03 15:33:54

问题


I have this command

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

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


回答1:


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




回答2:


That's it: How to Connect to the Database Engine using sqlcmd. Something like this:

sqlcmd -S ComputerA,1691



回答3:


Following solution is working for me in SQL Server 2008 and above.

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



来源:https://stackoverflow.com/questions/6099923/how-to-change-the-port-when-calling-sqlcmd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!