我从以下 URL 下载了 53.5 MB 的 SQL Server 2005 Express 安装程序:
Microsoft SQL Server 2005 Express Edition
然后我运行sqlcmd 通过进入命令提示符,但显示错误
HResult 0x2,级别 16,状态 1
命名管道提供程序:无法打开与 SQL Server 2。
Sqlcmd:错误:Microsoft SQL Native Client:发生错误
同时建立与服务器的连接。连接到 SQL Server 2005 时,
此故障可能是由于 SQL Server 默认设置下造成的
不允许远程连接..
Sqlcmd:错误:Microsoft SQL Native Client:登录超时已过期。
然后我从以下 URL 下载并安装了 Sql Command Line Utility:
Microsoft SQL Server 2005 功能包 - 2005 年 11 月
然后它也显示相同的错误。
然后我安装了Sql Native Client,然后它也不起作用。但是,当我安装 Management Studio 时,会从 Management Studio 建立连接,而不是从命令提示符的 sqlcmd 建立连接。
请帮忙。
I downloaded the 53.5 MB setup of SQL Server 2005 Express from this URL:
Microsoft SQL Server 2005 Express Edition
Then I ran sqlcmd by going into command promp , but it shows error
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server 2.
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred
while establishing a connection to the server. When connecting to SQL Server 2005,
this failure may be caused by the fact that under the default settings SQL Server
does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
Then I downloaded and installed Sql Command Line Utility from this URL:
Feature Pack for Microsoft SQL Server 2005 - November 2005
Then also it shows the same error.
Then I installed Sql Native Client, then also it didn't work. But when I installed Management Studio, then from Management Studio the connection is established, but not from sqlcmd from Command Prompt.
Please help.
发布评论
评论(2)
“仅单独输入 sqlcmd 是行不通的 - 该实用程序如何知道要连接哪个服务器、要使用哪个数据库以及要运行什么命令?”
有趣的事情。当我阅读 Microsoft 文档时,只需在服务器上键入 sqlcmd 就可以打开与该服务器的连接。至少可以,具体取决于安全设置。在没有任何登录/安全选项的情况下键入 sqlcmd 很可能会失败,但该实用程序肯定会尝试。
没有退出的 SQLCMD 就是这样,对吗?
"Just typing sqlcmd on its own won't work - how should the utility know what server to connect, what database to use, and what command to run??"
Funny thing. As I read the Microsoft documentation, just typing sqlcmd while sitting on the server should open a connection to this server. At least it can, depending on settings for security. Typing sqlcmd without any options for login/security may very well fail, but the utility will defintely try.
And SQLCMD without quit is just that, right?
如果您执行以下操作该怎么办:
仅单独输入
sqlcmd
不起作用 - 实用程序如何知道要连接哪个服务器、要使用哪个数据库以及要运行什么命令?您需要告诉
sqlcmd
您想做什么!使用 sqlcmd -? 获取其命令选项列表,研究它们并使用它们!或者阅读有关将 sqlcmd 实用程序与 SQL Server Express 结合使用的 MSDN 文档 -顺便说一句:在 MSDN 中搜索答案和文档将是解决所有 SQL Server 问题的好主意……肯定需要 SQL Native Client,是的 - 不确定第二个包是什么意思。
What if you do something like:
Just typing
sqlcmd
on its own won't work - how should the utility know what server to connect, what database to use, and what command to run??You need to tell
sqlcmd
what you want to do! Get a list of its command options usingsqlcmd -?
, study them, and use them! Or read the MSDN docs on Using the sqlcmd utility with SQL Server Express - btw: searching MSDN for answers and documentation would be a good idea for all your SQL Server problems......The SQL Native Client is definitely needed, yes - not sure what you mean by the second package there.