none
Connect to SQL Server from Command Prompt?

    Question

  • I installed SQL Server CTP version and tried to connect from Command Prompt, but failed from either osql or sqlcmd:

    osql [/sqlcmd] -H localhost -E

    or,

    osql [/sqlcmd] -H localhost -U sa -P SAPWD

    The error message is:

    Named Pipes Provider: Could not open a connection to SQL Server, ...

    Please note named pipes are enabled from client protocol configuration.

    without Management studio, how can I connect to the server?

    Thanks.


    PS: I had searched in the forum, but didn't find answer to above question.


    Friday, November 11, 2005 4:40 PM

Answers

  • -S is the parameter for the instancename e.g.

    sqlcmd -S (local) -E sqlcmd -S (local)\SQL01 -E

    For a windows authenticated connection to the default instance on the local machine you don't need any parameters for sqlcmd e.g

    sqlcmd

    Saturday, November 12, 2005 2:34 PM
  • Thanks for the replies.

    After a few attempts, I found the following command works:

    osql (or sqlcmd) -S .\SQLEXPRESS -E

    without instance name, it always timed out.
    Monday, November 14, 2005 3:25 AM

All replies

  • -S is the parameter for the instancename e.g. sqlcmd -S (local) -E sqlcmd -S (local)\SQL01 -E For a windows authenticated connection to the default instance on the local machine you don't need any parameters for sqlcmd e.g sqlcmd -- HTH Jasper Smith (SQL Server MVP) http://www.sqldbatips.com I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org wrote in message news:f756a7ad-017a-42a5-aa70-0908ad626391@discussions.microsoft.com... >I installed SQL Server CTP version and tried to connect from Command > Prompt, but failed from either osql or sqlcmd: > > osql [/sqlcmd] -H localhost -E > > or, > > osql [/sqlcmd] -H localhost -U sa -P SAPWD > > The error message is: > > Named Pipes Provider: Could not open a connection to SQL Server, ... > > Please note named pipes are enabled from client protocol configuration. > > without Management studio, how can I connect to the server? > > Thanks. > > > PS: I had searched in the forum, but didn't find answer to above > question. > > > > >
    Saturday, November 12, 2005 2:31 PM
  • -S is the parameter for the instancename e.g.

    sqlcmd -S (local) -E sqlcmd -S (local)\SQL01 -E

    For a windows authenticated connection to the default instance on the local machine you don't need any parameters for sqlcmd e.g

    sqlcmd

    Saturday, November 12, 2005 2:34 PM
  • Thanks for the replies.

    After a few attempts, I found the following command works:

    osql (or sqlcmd) -S .\SQLEXPRESS -E

    without instance name, it always timed out.
    Monday, November 14, 2005 3:25 AM