我正在尝试使用 sqlcmd 来执行一些 SQL 脚本。
使用带有简单查询的测试命令,例如:
sqlcmd -S HOSTNAME -d MYDATABASE -Q 'SELECT Names FROM Customers'
sqlcmd 似乎没有尝试连接到服务器,因为它显示以下消息:
Sqlcmd:错误:连接失败。
SQL Native Client 未正确安装。若要更正此问题,请运行 SQL Server 安装程序。
The native client was presumably installed as part of the SQL Server setup and likely correctly. I actually get this message on any machine with SQL server installed trying to use sqlcmd so it's not a matter of the installation being corrupt.
Unfortunately the message really tells me nothing about the problem so I don't know what the real issue is. I know the SQL Native client is working properly since a vbscript was able to execute SQL queries against the database.
Is there some additional configuration needed to use sqlcmd?