bcp error - at my wits end

  • Hi everyone,

    This one is reported all over the internet but none of the issues that commonly cause it make a lot of sense in my context.

    I need to regenerate some .dat files from the contents of a database. This normally works flawlessly, however, when I execute the commands as supplied from the Windows command prompt here's the output I see:

    c:\bcp>bcp "SELECT * FROM PSMS_Data2.gen.POSTCODE_LUT ORDER BY PostCodeKey" quer

    yout POSTCODE_LUT.dat -N -Usa

    Password:

    SQLState = S1000, NativeError = 0

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

    ile

    The .dat files should be created in the C:\bcp folder. I'm logged in with an administrative account and have write access to the folder. The folder is not a mapped network drive (obviously).

    I've tried various credentials, having first verified that they work by connecting to the local SQL Server instance using SSMS, both locally and remotely. As you can see, in the above command I'm using the sa account. I have correctly entered the password.

    The PSMS_Data2 database exists, as does the gen.POSTCODE_LUT table. The sa account, as you'd expect, has full access to the database.

    I'm running Windows Server 2012, SQL Server 2014 Standard Edition SP1, and have RDPed directly into the box.

    Does anybody have any ideas about what might be wrong*, please?

    Thanks,

    Bart

    (*I have to say that, even by Microsoft's standards, this is a particularly unhelpful and opaque error message. It seems there are any of about half a dozen common causes for it, none of which are obvious based on the reported error.)

  • Oh cock. Sorry - entirely my fault. Should have been running command in an administrative command prompt - do that and it works fine.

    Thanks!

    Bart

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply