I've got a large SQL script (1gb) that I'm trying to run against a (localdb)\v11.0
instance, using SqlCmd
in a command line window, but so far no commands I've tried have worked with it at all.
我有一个大的SQL脚本(1gb),我正在尝试针对(localdb)\ v11.0实例运行,在命令行窗口中使用SqlCmd,但到目前为止还没有尝试使用它的命令一点都不
E.g.
sqlcmd.exe -S "(localdb)\v11.0" -Q "select 1"
fails with a generic connection error:
失败并出现通用连接错误:
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.
建立与SQL Server的连接时发生了与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。检查实例名称是否正确以及SQL Server是否配置为允许远程连接。
However
sqlcmd.exe -S "MY-PC" -Q "select 1"
is fine with the SQL Server instance on my PC.
我的电脑上的SQL Server实例很好用。
"Allow Remote Connections" is set to true on the (localdb)
instance and the user I'm running the sqlcmd
with is the owner of it.
“允许远程连接”在(localdb)实例上设置为true,而我正在运行sqlcmd的用户是它的所有者。
Does Sqlcmd
actually work with (localdb)
instances? Are there any other obvious things I might be doing wrong?
Sqlcmd实际上是否与(localdb)实例一起使用?还有其他明显的事情我可能做错了吗?
2 个解决方案
#1
2
I believe this can happen when you use the wrong version of SQLCMD for the LocalDB instance as described in this post...
我相信当您使用错误版本的SQLCMD进行LocalDB实例时会发生这种情况,如本文所述......
Why can't I connect to a SQL Server 2012 LocalDB shared instance?
为什么我无法连接到SQL Server 2012 LocalDB共享实例?
Hth, Ojf
#2
0
Change your working folder to C:\Program Files\Microsoft SQL Server\110\Tools\Binn
将您的工作文件夹更改为C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn
cd "C:\Program Files\Microsoft SQL Server\110\Tools\Binn"
cd“C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn”
and try again...
然后再试一次...
sqlcmd.exe -S "MY-PC"
sqlcmd.exe -S“MY-PC”
#1
2
I believe this can happen when you use the wrong version of SQLCMD for the LocalDB instance as described in this post...
我相信当您使用错误版本的SQLCMD进行LocalDB实例时会发生这种情况,如本文所述......
Why can't I connect to a SQL Server 2012 LocalDB shared instance?
为什么我无法连接到SQL Server 2012 LocalDB共享实例?
Hth, Ojf
#2
0
Change your working folder to C:\Program Files\Microsoft SQL Server\110\Tools\Binn
将您的工作文件夹更改为C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn
cd "C:\Program Files\Microsoft SQL Server\110\Tools\Binn"
cd“C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn”
and try again...
然后再试一次...
sqlcmd.exe -S "MY-PC"
sqlcmd.exe -S“MY-PC”