SQL 2005 character-based SQLCMD utility does not work

I open the Command prompt (using vista premium home)
I get
C:\Users\Avner>
I type
SQLCMD
and i get
HResult 0X2, Level 16,  State 1
Named Pipe Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL native Client: An Error has occurred while astablishing a connection to the server

(now it suggests that the default settings do mot allow remote connection.. but i believe i enabled it)
HResult 0X2, Level 16,  State 1
Named Pipe Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL native Client: An Error has occurred while astablishing a connection to the server

Open in new window

Avner_LAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
now you are connected successfully, and you can run the sql commands:
technet.microsoft.com/en-us/library/ms162773.aspx

0
 
lexiflexCommented:
Have tried using the -S and -E or -U and -P parameters?

SQLCMD -S <instancename> -E
or
SQLCMD -S <instancename> -U <login> -P <password>

<instancename> could be <servername>\<instancename> for a named instance or just <servename> for a primary instance.
0
 
Avner_LAuthor Commented:
What should I write in  instancename?
if iwrite excatly as you did, I get
"The system cannot find the file specified"
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
if it is a named instance, you have to put
servername\instancename

or, if the sql server is installed locally, simply
.\instancename

0
 
Avner_LAuthor Commented:
I am sorry i am not sure if the sql is installed locally

and...  my computer is called  AVNER-PC
what exactlly do i write?

in my manual it is suggested that if i just type SQLCMD a connection must be established
0
 
lexiflexCommented:
Are you able to connect to the SQL Server with SQL Server Management Studio or any other application? If so what is the name featured as servername in the login-box or Object Browser?
0
 
Avner_LAuthor Commented:
Yes i can
With managemant studio
the server name is

AVNER-PC\SQLEXPRESS
0
 
lexiflexCommented:
Alright, try this with sqlcmd:

SQLCMD -S "AVNER-PC\SQLEXPRESS" -E

The -S switch is the SQL Server you're connecting to and the -E means you're connecting with integrated security.
I added the quotes because I'n not sure SQLCMD can handle the "-" sign in the servername otherwise.
0
 
Avner_LAuthor Commented:
These are the results:
i type

SQLCMD -S "AVNER-PC\SQLEXPRESS" -E
 and i get
Sqlcmd: '   '  : Unknown option. Enter '?' for help

and when i try the same with '  instead of " 
it again defines an error
0
 
lexiflexCommented:
That's weird, when run this exact command I get a message about not being able to connect to the SQL Server instance.

Could you run the SQLCMD -? command to find out which version it is running. See example below.
C:\>sqlcmd -?
Microsoft (R) SQL Server Command Line Tool
Version 9.00.3042.00 NT INTEL X86
Copyright (c) Microsoft Corporation.  All rights reserved.

Open in new window

0
 
Avner_LAuthor Commented:
That's exactly what i get
(version 9... etc)
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
what about this:
SQLCMD -S AVNER-PC\SQLEXPRESS -E
0
 
Avner_LAuthor Commented:
ok
so i type
SQLCMD -S AVNER-PC\SQLEXPRESS -E
i get
1>

what now?
0
All Courses

From novice to tech pro — start learning today.