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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 bcp error

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-05-08 : 08:03:54
Y writes "Hi,

I am trying to copy some data from a data file to a table using xp_cmdshell and bcp. The data file resides on a different machine from the database server. The bcp command looks like this:

bcp "database..tablename" in "\\mynetworkpath\mydatafile" -fMyformatfile -Uuser -Ppassword -Smyservername

If I run this bcp command using xp_cmdshell from Query Analyzer, I'll get this error,"Unable to open BCP host data-file." But I can successfully import my data to the table if I execute this bcp command from Command Prompt. I think it's some set up on the server side but don't know where to start. Thanks."

Andraax
Aged Yak Warrior

790 Posts

Posted - 2003-05-08 : 08:26:04
Check out what account the SQL Server Service is using. That is the security context which will be used by xp_cmdshell. Make sure the account has permission to access the file.

Go to Top of Page
   

- Advertisement -