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
 General SQL Server Forums
 New to SQL Server Programming
 BCP problem using command prompt

Author  Topic 

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2008-03-26 : 08:55:00
I am have trouble configuring developer edition when trying to run a Bulk Copy through Command Prompt. I have configured remote connections within the surface area configuration and have created a firewall exception

I enter and run

bcp FileImportDB..Exam in "c:\FileImportPractice\ExamImportFile.txt" -T -c

then i get the following error message

Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\Users\Dineen>bcp FileImportDB.Exam in "c:\FileImportPractice\ExamImportFile.t
xt" -T -c
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.


I am running developer edition on vista and Service pack 2, iam connecting to my instance with no problem.

Can someone please help

Kind regards

Rob

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-03-26 : 10:10:22
Can you run this with a SQL User rather than a trusted login?
Go to Top of Page

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2008-03-26 : 10:15:31
I only using a trusted login at the moment because i am going through
my MCTS course.

could you tell where i am going wrong at all please
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-26 : 13:22:11
Looks like you don't have the correct server
try adding
-S<machineame>\<instanstancename> to the command

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2008-03-26 : 14:21:47
THank you NR

I have amended the command with computerName and Instance name
and it looks like a connection is made, but i get the following
message instead

C:\Users\Dineen>bcp FileImportDB..Exam in "c:\FileImportPractice\ExamImportFile.
txt" -T -c -S DINEENPC\NEWMANSLANE
SQLState = HY000, NativeError = 0
Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file


is there something i have to do with the text file??

Kind Regards


Rob
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-03-26 : 14:31:53
It means the txt file isn't there.
Check for mispellings.
The c drive will be the machine on which you are running the command. If it's actually on the server then use xp_cmdshell to run it.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2008-03-26 : 14:54:16
THank you very much Nigel

I am teaching myself SQL SERVER 2005 to get my MCTS, and the microsoft book has a few mistakes with syntax sometimes

Do you know anyone who need a trainee / Junior SQL DBA

Just to be cheeky

So thank you very much.

Regards

Rob
Go to Top of Page
   

- Advertisement -