Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    8

    Unanswered: bcp error: Unable to open BCP host data-file

    I get this error message:

    Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file

    if I try to run

    EXEC master..xp_cmdshell
    'bcp TestDB.dbo.Employees out \\Ioana\Export\Employees.txt -c -t"," '

    from Query Analyzer (or a store procedure).


    If run the same command in cmd or run window (of course without EXEC and xp_cmdshell) I do not get any error and the content of the table is exported in the file I want...

    If the exported file is on a local folder on the server everything is working fine even in Query Analyzer...

    Thanking in Advance

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    My guess is that the user that runs SQL server (default is LocalSystem) has no permissions on the server called Ioana. If SQL Server is running under LocalSystem, you will have to create a domian (or domain local) account for SQL Server to run under. Then grant that user permission on this share on Ioana. You will also have to add the user to the local administrators group on the SQL Server, too. Hope this helps.

  3. #3
    Join Date
    Sep 2003
    Posts
    8
    Originally posted by MCrowley
    My guess is that the user that runs SQL server (default is LocalSystem) has no permissions on the server called Ioana. If SQL Server is running under LocalSystem, you will have to create a domian (or domain local) account for SQL Server to run under. Then grant that user permission on this share on Ioana. You will also have to add the user to the local administrators group on the SQL Server, too. Hope this helps.
    SQL Server is install on SQLSERVER machine and Ioana is my machine.
    I want to run this script on SQLSERVER machine (in Query Analyzer) and to export the file in Export directory on my machine. The Export directory on my machine is shared with all the rights.

    If run the bcp from cmd window on SQLSERVER machine is working fine. From Query Analyzer on the same machine (SQLSERVER) is not working even if I am logged in as system administrator with windows authentication. The administrator of SQLSERVER have full permision on my shared directory.

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •