开发者

How to change the port when calling sqlcmd

开发者 https://www.devze.com 2023-03-08 06:07 出处:网络
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 s

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.


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


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

sqlcmd -S ComputerA,1691


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

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


Mayo/23/2022, works

sqlcmd -S "hostname or IP,port number"

SQL Express 2019 from linux ubuntu client connecting to sql express on windows server

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号