【发布时间】:2015-07-20 21:18:50
【问题描述】:
当执行以下任一命令时:
osql -E -S ComputerName\InstanceName
osql -E -S ComputerName\InstanceName -i MyScript.sql -o MyOutput.rpt
osql -E -q "SELECT * FROM Northwind.dbo.Shippers"
osql -E -Q "SELECT * FROM Northwind.dbo.Shippers" -o MyOutput.rpt
我收到以下错误:
[SQL Server Native Client 10.0]SQL Server Network Interfaces: Connection
string is not valid [87].
[SQL Server Native Client 10.0]Login timeout expired
[SQL Server Native Client 10.0]A network-related or instance-specific error
has occurred while establishing a connection to SQL Server. Server is not
found or not accessible. Check if instance name is correct and if SQL Server
is configured to allow remote connections. For more information see SQL Server
Books Online.
但是,我可以毫无问题地从 SSMS 登录并运行 SELECT 查询。
如何使用 osql 针对 SQL Server 2008 运行查询?
【问题讨论】:
-
更好:Google.com
标签: sql sql-server database sql-server-2008 osql