Home Forums SQL Server 7,2000 T-SQL BCP error -Unable to open BCP host data-file RE: BCP error -Unable to open BCP host data-file

  • tsandeep1407 (3/21/2013)


    Hi everyone,

    I have this error output in SSMS for the following query

    exec Master..xp_cmdshell 'bcp "select blobdata from SynDocs.dbo.BLOBDATA where blobid = 2" queryout "c:\filename2.img" -S ROK-W7STHONUK-7 -T'

    The output is 2 rows

    NULL

    Enter the file storage type of field blobdata [image]:

    when i run the same query thru cmd prompt, the result is

    SQLState = S1000, NativeError = 0

    Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file.

    any of you help me with this please.

    I know it's an older post but the problem here is that the "-c" parameter wasn't specified. I would also recommend the "-C Raw" parameter (notice the difference in case) but leaving that out isn't a showstopper.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)