开发者

sqlcmd not working after installing sql server 2005 express

开发者 https://www.devze.com 2023-03-01 13:34 出处:网络
I downloaded the 53.5 MB setup of SQL Server 2005 Express from this URL: Micro开发者_如何学编程soft SQL Server 2005 Express Edition

I downloaded the 53.5 MB setup of SQL Server 2005 Express from this URL:

Micro开发者_如何学编程soft 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.


"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?


What if you do something like:

sqlcmd -S W\SQLEXPRESS -E -d master -q "select * from sys.tables"

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 using sqlcmd -?, 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.

0

精彩评论

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