Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 bcp problem

Author  Topic 

JohnJohn73
Yak Posting Veteran

57 Posts

Posted - 2008-03-25 : 13:16:03
OK, I am trying to use bcp to copy my table to a datafile.

Here's my command prompt syntax:

c:\MyDB>bcp MyDB.Employees out Employees.dat -c -U sa -P [pwd here]

I get the following errors:

SQLState=08001,NativeError=2
Error=[Microsoft][SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [2]
SQLState =HYT00, NativeError=0
Error =[Microsoft][SQL Native Client] Login timeout expired
SQLState =08001, NativeError=2
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.

However, the Server is set with remote configurations ON and the client program can access the database with the sa account and the password.

Also SQL Management Studio Express opens the database with no problem using the sa account and password. What else do I need to make bcp work?

Thanks for any help.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-25 : 13:19:39
[code]bcp MyDB.dbo.Employees out Employees.dat -S <server-name> -c -U sa -P [pwd here][/code]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

JohnJohn73
Yak Posting Veteran

57 Posts

Posted - 2008-03-25 : 13:22:00
Tried that too, as well as the -T connection. I get the same errors.
Go to Top of Page

PABluesMan
Starting Member

26 Posts

Posted - 2008-03-25 : 15:33:40
Tis is gonna sound stupid, but try taking the spaces out after the switches:

bcp MyDB.dbo.Employees out Employees.dat -S<server-name> -c -Usa -P[pwd here]



I geek, therefore I am
Go to Top of Page

JohnJohn73
Yak Posting Veteran

57 Posts

Posted - 2008-03-25 : 16:00:26
I tried it with spaces and without(like the documentation). Same result.

I have no clue why the bcp utility can't get it done. Luckily for me, the table has only 81 rows.

Thanks again to everybody.

Maybe tomorrow I'll wake up and the problem will be solved!
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-25 : 16:03:35
Are you sitting by the server?
BCP is installed on the SQL server machine, not your local machine.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -